mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 19:00:24 +00:00
include: add paramter to hide first heading #43
This commit is contained in:
parent
4ba89ec502
commit
3931faa1d5
7 changed files with 46 additions and 7 deletions
|
@ -30,7 +30,6 @@ module.exports = {
|
|||
milestoneMatch: "{{tag_name}}",
|
||||
onlyMilestones: true,
|
||||
template: {
|
||||
changelogTitle: "",
|
||||
group: "\n### {{heading}}\n",
|
||||
release: ({ body, date, release }) => `## ${release} (` + date.replace( /(\d+)\/(\d+)\/(\d+)/, '$3-$2-$1' ) + `)\n${body}`,
|
||||
},
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# Changelog
|
||||
|
||||
## 1.2.0 (2021-07-26)
|
||||
|
||||
### Enhancements
|
||||
|
@ -15,11 +17,14 @@
|
|||
|
||||
### Bug Fixes
|
||||
|
||||
- [**bug**] dependency: upgrade jquery to 3.6.0 [#30](https://github.com/McShelby/hugo-theme-relearn/issues/30)
|
||||
- [**bug**] attachments: support i18n for attachment size [#21](https://github.com/McShelby/hugo-theme-relearn/issues/21)
|
||||
- [**bug**] notice: support i18n for box labels [#16](https://github.com/McShelby/hugo-theme-relearn/issues/16)
|
||||
- [**bug**] notice: support multiple blocks in one box [#15](https://github.com/McShelby/hugo-theme-relearn/issues/15)
|
||||
|
||||
### Maintenance
|
||||
|
||||
- [**task**] dependency: upgrade jquery to 3.6.0 [#30](https://github.com/McShelby/hugo-theme-relearn/issues/30)
|
||||
|
||||
---
|
||||
|
||||
## 1.1.1 (2021-07-04)
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
title = "History"
|
||||
weight = 30
|
||||
+++
|
||||
{{% include "basics/CHANGELOG.md" %}}
|
||||
{{% include "basics/CHANGELOG.md" false %}}
|
||||
|
|
|
@ -4,7 +4,7 @@ You can add:
|
|||
- bullet point lists
|
||||
- _emphasized_, **bold** and even **_bold emphasized_** text
|
||||
- [links](https://example.com)
|
||||
- other shortcodes besides `expand`
|
||||
- other shortcodes besides `include`
|
||||
- etc.
|
||||
|
||||
```plaintext
|
||||
|
|
|
@ -8,9 +8,13 @@ The include shortcode includes other files from your project inside of the curre
|
|||
## Usage
|
||||
|
||||
````go
|
||||
{{%/* include "<file>" */%}}
|
||||
{{%/* include "<file>" { "true" | "false" } */%}}
|
||||
````
|
||||
|
||||
The first parameter is the path to the file to be included.
|
||||
|
||||
If the file's content will be displayed as HTML, the second optional parameter controls if the first heading of the included file should be displayed ("true")- which is the default - or be hidden.
|
||||
|
||||
## Examples
|
||||
|
||||
### Arbitray content
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
{{ $file := .Get 0 }}
|
||||
{{ $showFirstHeading := .Get 1 | default true }}
|
||||
<div class="include{{if not $showFirstHeading }} hide-first-heading{{end}}">
|
||||
|
||||
{{ $file | readFile | safeHTML }}
|
||||
</div>
|
||||
|
|
|
@ -1154,3 +1154,30 @@ option {
|
|||
margin-bottom: 1.7rem;
|
||||
margin-top: 1.7rem;
|
||||
}
|
||||
|
||||
.include.hide-first-heading h1:first-of-type,
|
||||
.include.hide-first-heading h2:first-of-type,
|
||||
.include.hide-first-heading h3:first-of-type,
|
||||
.include.hide-first-heading h4:first-of-type,
|
||||
.include.hide-first-heading h5:first-of-type,
|
||||
.include.hide-first-heading h6:first-of-type {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.include.hide-first-heading h1 + h2:first-of-type,
|
||||
.include.hide-first-heading h1 + h3:first-of-type,
|
||||
.include.hide-first-heading h2 + h3:first-of-type,
|
||||
.include.hide-first-heading h1 + h4:first-of-type,
|
||||
.include.hide-first-heading h2 + h4:first-of-type,
|
||||
.include.hide-first-heading h3 + h4:first-of-type,
|
||||
.include.hide-first-heading h1 + h5:first-of-type,
|
||||
.include.hide-first-heading h2 + h5:first-of-type,
|
||||
.include.hide-first-heading h3 + h5:first-of-type,
|
||||
.include.hide-first-heading h4 + h5:first-of-type,
|
||||
.include.hide-first-heading h1 + h6:first-of-type,
|
||||
.include.hide-first-heading h2 + h6:first-of-type,
|
||||
.include.hide-first-heading h3 + h6:first-of-type,
|
||||
.include.hide-first-heading h4 + h6:first-of-type,
|
||||
.include.hide-first-heading h5 + h6:first-of-type {
|
||||
display: block;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue