mirror of
https://github.com/loikein/hugo-tufte.git
synced 2024-12-23 22:09:44 +01:00
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
|
||||
|
||||
- `sidenote`: Wrap text to produce an automatically numbered sidenote.
|
||||
The single positional argument is a required unique identifier.
|
||||
Example: `{{% sidenote "sn-example" %}}Some sidenote{{% /sidenote %}}`
|
||||
- `marginnote`: Wrap text to produce a numberless margin note.
|
||||
The single positional argument is a required unique identifier.
|
||||
Example: `{{% marginnote"mn-example" %}}Some marginnote{{% /marginnote%}}`
|
||||
This theme provides the following shortcodes.
|
||||
|
||||
- `marginnote`
|
||||
- Description: Wrap text to produce a numberless margin note.
|
||||
- Usage: Accepts a required positional argument that is the margin note id.
|
||||
`{{% 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
|
||||
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