mirror of
https://github.com/loikein/hugo-tufte.git
synced 2024-12-23 22:09:44 +01:00
Removing dom ID requirement for margin/sidenotes (#10)
* Removing dom ID requirement for margin/sidenotes Prior to this commit, when using the `marginnote` or `sidenote` shortcodes, you would need to pass a domId parameter to the shortcode. With this change you no longer need to pass a parameter, and any parameter passed is ignored. The pre-amble creates a unique domID for the shortcodes. * Replacing convoluted Scratch with Ordinal I was leveraging the Scratch function of Hugo, when I could instead rely on `.Ordinal`
This commit is contained in:
parent
cfa6769e1c
commit
4299d3bfdb
3 changed files with 20 additions and 22 deletions
12
README.md
12
README.md
|
@ -105,9 +105,8 @@ support all the features present in the
|
|||
|
||||
- `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%}}`
|
||||
- Usage: `{{% marginnote %}}...{{% /marginnote %}}`
|
||||
- **Example**: `{{% marginnote %}}Some marginnote{{% /marginnote%}}`
|
||||
|
||||
- `section`
|
||||
- **Description**: This shortcode is provided as a work-around for wrapping
|
||||
|
@ -123,10 +122,9 @@ support all the features present in the
|
|||
|
||||
- `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 %}}`
|
||||
- **Usage**: identical to `marginnote`
|
||||
`{{% sidenote %}}...{{% /sidenote %}}`
|
||||
- **Example**: `{{% sidenote %}}Some sidenote{{% /sidenote %}}`
|
||||
|
||||
|
||||
## Templates
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<label for="{{ .Get 0 }}" class="margin-toggle">⊕</label>
|
||||
<input type="checkbox" id="{{ .Get 0 }}" class="margin-toggle"/>
|
||||
{{ $marginnoteDomIdSuffix := .Ordinal }}<label for="marginnote-{{.Page.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle">⊕</label>
|
||||
<input type="checkbox" id="marginnote-{{.Page.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle"/>
|
||||
<span class="marginnote">{{ .Inner }}</span>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<label for="{{ .Get "id" }}" class="margin-toggle sidenote-number"></label>
|
||||
<input type="checkbox" id="{{ .Get "id" }}" class="margin-toggle"/>
|
||||
{{ $sidenoteDomIdSuffix := .Ordinal }}<label for="sidenote-{{.Page.UniqueID}}-{{ $sidenoteDomIdSuffix }}" class="margin-toggle sidenote-number"></label>
|
||||
<input type="checkbox" id="sidenote-{{.Page.UniqueID}}-{{ $sidenoteDomIdSuffix }}" class="margin-toggle"/>
|
||||
<span class="sidenote">{{ .Inner }}</span>
|
||||
|
|
Loading…
Reference in a new issue