mirror of
https://github.com/loikein/hugo-tufte.git
synced 2024-12-23 22:09:44 +01:00
new features for margin/side note
This commit is contained in:
parent
233074c9bf
commit
a1b9b7dcbd
3 changed files with 11 additions and 8 deletions
|
@ -16,8 +16,8 @@
|
||||||
{{ if .Get "link" }}</a>{{ end }}
|
{{ if .Get "link" }}</a>{{ end }}
|
||||||
<figcaption>
|
<figcaption>
|
||||||
{{ else }}{{/* margin or normal */}}
|
{{ else }}{{/* margin or normal */}}
|
||||||
<label for="{{ .Get "label" }}" class="margin-toggle">💬</label>
|
<label for="{{ .Get "label" }}" class="margin-toggle marginnote-ind">{{ .Site.Params.marginNoteInd }}</label>
|
||||||
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle">
|
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle"/>
|
||||||
<span class="marginnote">
|
<span class="marginnote">
|
||||||
{{ if eq $type "margin" }}
|
{{ if eq $type "margin" }}
|
||||||
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
|
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
{{ $marginnoteDomIdSuffix := .Ordinal }}
|
{{- $marginnoteDomIdSuffix := (add .Ordinal 1) -}}
|
||||||
<label for="marginnote-{{.Page.File.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle marginnote-ind">💬</label>
|
{{- $ind := .Get "ind" | default .Site.Params.marginNoteInd -}}
|
||||||
<input type="checkbox" id="marginnote-{{.Page.File.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle"/>
|
<label for="marginnote-{{ $marginnoteDomIdSuffix }}" class="margin-toggle marginnote-ind">{{ $ind }}</label>
|
||||||
<span class="marginnote"><span class="marginnote-ind">💬</span> {{ .Inner | markdownify}}</span>
|
<input type="checkbox" id="marginnote-{{ $marginnoteDomIdSuffix }}" class="margin-toggle"/>
|
||||||
|
<span class="marginnote">
|
||||||
|
{{ .Inner | markdownify}}
|
||||||
|
</span>
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $.Page.Scratch.Set "sidenoteCounter" 1 -}}
|
{{- $.Page.Scratch.Set "sidenoteCounter" 1 -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ $sidenoteDomIdSuffix := $.Page.Scratch.Get "sidenoteCounter" }}
|
{{- $sidenoteDomIdSuffix := $.Page.Scratch.Get "sidenoteCounter" -}}
|
||||||
<label for="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle sidenote-number">({{ $sidenoteDomIdSuffix }})</label>
|
<label for="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle sidenote-number">({{ $sidenoteDomIdSuffix }})</label>
|
||||||
<input type="checkbox" id="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle"/>
|
<input type="checkbox" id="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle"/>
|
||||||
<span class="sidenote">
|
<span class="sidenote">
|
||||||
<span class="sidenote-number">({{ $sidenoteDomIdSuffix }})</span> {{ .Inner | markdownify }}
|
<span class="sidenote-number">({{ $sidenoteDomIdSuffix }})</span>{{ .Inner | markdownify }}
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue