new features for margin/side note

This commit is contained in:
loikein 2023-04-15 15:31:10 +01:00
parent 233074c9bf
commit a1b9b7dcbd
3 changed files with 11 additions and 8 deletions

View file

@ -16,8 +16,8 @@
{{ if .Get "link" }}</a>{{ end }}
<figcaption>
{{ else }}{{/* margin or normal */}}
<label for="{{ .Get "label" }}" class="margin-toggle">&#128172;</label>
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle">
<label for="{{ .Get "label" }}" class="margin-toggle marginnote-ind">{{ .Site.Params.marginNoteInd }}</label>
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle"/>
<span class="marginnote">
{{ if eq $type "margin" }}
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}

View file

@ -1,4 +1,7 @@
{{ $marginnoteDomIdSuffix := .Ordinal }}
<label for="marginnote-{{.Page.File.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle marginnote-ind">&#128172;</label>
<input type="checkbox" id="marginnote-{{.Page.File.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle"/>
<span class="marginnote"><span class="marginnote-ind">&#128172;</span> {{ .Inner | markdownify}}</span>
{{- $marginnoteDomIdSuffix := (add .Ordinal 1) -}}
{{- $ind := .Get "ind" | default .Site.Params.marginNoteInd -}}
<label for="marginnote-{{ $marginnoteDomIdSuffix }}" class="margin-toggle marginnote-ind">{{ $ind }}</label>
<input type="checkbox" id="marginnote-{{ $marginnoteDomIdSuffix }}" class="margin-toggle"/>
<span class="marginnote">
{{ .Inner | markdownify}}
</span>

View file

@ -3,7 +3,7 @@
{{- else -}}
{{- $.Page.Scratch.Set "sidenoteCounter" 1 -}}
{{- end -}}
{{ $sidenoteDomIdSuffix := $.Page.Scratch.Get "sidenoteCounter" }}
{{- $sidenoteDomIdSuffix := $.Page.Scratch.Get "sidenoteCounter" -}}
<label for="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle sidenote-number">({{ $sidenoteDomIdSuffix }})</label>
<input type="checkbox" id="sidenote-{{ $sidenoteDomIdSuffix }}" class="margin-toggle"/>
<span class="sidenote">