forked from mirrors/hugo-tufte
Add section shortcode.
It seems there are some issues in wrapping complex blocks of markdown in html tags, especially when the block contains other short codes. Content would either only partially render or fail completely.
This commit is contained in:
parent
7584401279
commit
45c0414b3d
2 changed files with 31 additions and 6 deletions
28
README.md
28
README.md
|
@ -31,12 +31,28 @@ The site specific parameters that this theme :wrecognizes are:
|
||||||
|
|
||||||
## Shortcodes
|
## Shortcodes
|
||||||
|
|
||||||
- `sidenote`: Wrap text to produce an automatically numbered sidenote.
|
This theme provides the following shortcodes.
|
||||||
The single positional argument is a required unique identifier.
|
|
||||||
Example: `{{% sidenote "sn-example" %}}Some sidenote{{% /sidenote %}}`
|
- `marginnote`
|
||||||
- `marginnote`: Wrap text to produce a numberless margin note.
|
- Description: Wrap text to produce a numberless margin note.
|
||||||
The single positional argument is a required unique identifier.
|
- Usage: Accepts a required positional argument that is the margin note id.
|
||||||
Example: `{{% marginnote"mn-example" %}}Some marginnote{{% /marginnote%}}`
|
`{{% marginnote "<margin note id>"" %}}...{{% /marginnote %}}`
|
||||||
|
- Example: `{{% marginnote "mn-example" %}}Some marginnote{{% /marginnote%}}`
|
||||||
|
|
||||||
|
- `section`
|
||||||
|
- Description: This shortcode is provided as a work-around for wrapping
|
||||||
|
complex blocks of markdown in section tags.
|
||||||
|
- Usage: `{{< section "<begin || end>" >}}` map respectively to
|
||||||
|
`<section>` and `</section>` tags.
|
||||||
|
- Example: `{{< section "begin" >}}` inserts a `<section>` tag, while
|
||||||
|
`{{<section "end" >}}` inserts the closing `</section>` tag.
|
||||||
|
|
||||||
|
- `sidenote`
|
||||||
|
- Description: Wrap text to produce an automatically numbered sidenote.
|
||||||
|
- Usage: identical to `marginnote`.
|
||||||
|
Accepts a required positional argument that is the side note id.
|
||||||
|
`{{% sidenote "<side note id>"" %}}...{{% /sidenote %}}`
|
||||||
|
- Example: `{{% sidenote "sn-example" %}}Some sidenote{{% /sidenote %}}`
|
||||||
|
|
||||||
## Templates
|
## Templates
|
||||||
TODO
|
TODO
|
||||||
|
|
9
layouts/shortcodes/section.html
Normal file
9
layouts/shortcodes/section.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{{ with .Get 0 }}
|
||||||
|
{{ if eq . "begin" }}
|
||||||
|
<section>
|
||||||
|
{{ else if eq . "end" }}
|
||||||
|
</section>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue