From 61a3995389db5b5e61a4bf4eb021e8c1792e30b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Wed, 31 May 2023 23:44:27 +0200 Subject: [PATCH] footnotes: render at end of page for all shortcodes #547 --- exampleSite/content/shortcodes/INCLUDE_ME.md | 4 +++- .../content/shortcodes/children/_index.en.md | 1 + exampleSite/content/shortcodes/expand.en.md | 14 +++++++++++++- layouts/partials/shortcodes/badge.html | 2 +- layouts/partials/shortcodes/button.html | 4 ++-- layouts/shortcodes/attachments.html | 1 - layouts/shortcodes/badge.html | 1 - layouts/shortcodes/button.html | 1 - layouts/shortcodes/children.html | 1 - layouts/shortcodes/expand.html | 1 - layouts/shortcodes/icon.html | 1 - layouts/shortcodes/math.html | 1 - layouts/shortcodes/mermaid.html | 1 - layouts/shortcodes/notice.html | 2 -- 14 files changed, 20 insertions(+), 15 deletions(-) diff --git a/exampleSite/content/shortcodes/INCLUDE_ME.md b/exampleSite/content/shortcodes/INCLUDE_ME.md index 58dc4e1b29..d2cfce1c2a 100644 --- a/exampleSite/content/shortcodes/INCLUDE_ME.md +++ b/exampleSite/content/shortcodes/INCLUDE_ME.md @@ -4,7 +4,9 @@ You can add standard markdown syntax: - bullet point lists - _emphasized_, **bold** and even **_bold emphasized_** text - [links](https://example.com) -- etc. +- etc.[^etc] + +[^etc]: Et Cetera (English: /ɛtˈsɛtərə/), abbreviated to etc., etc, et cet., is a Latin expression that is used in English to mean "and other similar things", or "and so forth" ```plaintext ...and even source code diff --git a/exampleSite/content/shortcodes/children/_index.en.md b/exampleSite/content/shortcodes/children/_index.en.md index d7b67da0a0..a96fd55ed9 100644 --- a/exampleSite/content/shortcodes/children/_index.en.md +++ b/exampleSite/content/shortcodes/children/_index.en.md @@ -7,6 +7,7 @@ title = "Children" The `children` shortcode lists the child pages of the current page and its descendants. {{% children sort="weight" %}} + ## Usage While the examples are using shortcodes with named parameter you are free to also call this shortcode from your own partials. diff --git a/exampleSite/content/shortcodes/expand.en.md b/exampleSite/content/shortcodes/expand.en.md index 67b2336486..71b33737c3 100644 --- a/exampleSite/content/shortcodes/expand.en.md +++ b/exampleSite/content/shortcodes/expand.en.md @@ -5,7 +5,19 @@ title = "Expand" The `expand` shortcode displays an expandable/collapsible section of text. -{{% expand title="Expand me..." %}}Thank you!{{% /expand %}} +{{% expand title="Expand me..." %}}Thank you! + +That's some text with a footnote[^1] + +[^1]: And that's the footnote. + +That's some more text with a footnote.[^someid] + +[^someid]: + Anything of interest goes here. + + Blue light glows blue. +{{% /expand %}} {{% notice note %}} This only works in modern browsers flawlessly. While Internet Explorer 11 has issues in displaying it, the functionality still works. diff --git a/layouts/partials/shortcodes/badge.html b/layouts/partials/shortcodes/badge.html index 40e8c0df69..002ffc630f 100644 --- a/layouts/partials/shortcodes/badge.html +++ b/layouts/partials/shortcodes/badge.html @@ -16,5 +16,5 @@ {{- $icon = printf "fa-fw fas fa-%s" $icon }} {{- end }} {{- with $context -}} -{{ if or $icon $title }}{{ if $icon }}{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | markdownify }}{{ end }}{{ end }}{{ $content }} +{{ if or $icon $title }}{{ if $icon }}{{ end }}{{ if and $icon $title }} {{ end }}{{ if $title }}{{ $title | markdownify }}{{ end }}{{ end }}{{ $content | markdownify }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/shortcodes/button.html b/layouts/partials/shortcodes/button.html index 210a4b313b..07689223ac 100644 --- a/layouts/partials/shortcodes/button.html +++ b/layouts/partials/shortcodes/button.html @@ -44,8 +44,8 @@ {{- end }} {{- if and $icon (eq $iconposition "left") }} - {{- end }} - {{ $title | safeHTML }} + {{- end }} + {{ $title | markdownify }} {{- if and $icon (eq $iconposition "right") }} {{- end }} diff --git a/layouts/shortcodes/attachments.html b/layouts/shortcodes/attachments.html index 34a7ee7157..9f370d72bd 100644 --- a/layouts/shortcodes/attachments.html +++ b/layouts/shortcodes/attachments.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/attachments.html" (dict "context" .Page "color" (.Get "color") diff --git a/layouts/shortcodes/badge.html b/layouts/shortcodes/badge.html index b3c4163c03..7136cf84c5 100644 --- a/layouts/shortcodes/badge.html +++ b/layouts/shortcodes/badge.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/badge.html" (dict "context" .Page "color" (.Get "color") diff --git a/layouts/shortcodes/button.html b/layouts/shortcodes/button.html index 1e9941d1ab..22ccaeb2fa 100644 --- a/layouts/shortcodes/button.html +++ b/layouts/shortcodes/button.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/button.html" (dict "context" .Page "color" (.Get "color") diff --git a/layouts/shortcodes/children.html b/layouts/shortcodes/children.html index d000514859..01f2037dba 100644 --- a/layouts/shortcodes/children.html +++ b/layouts/shortcodes/children.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/children.html" (dict "context" .Page "containerstyle" (.Get "containerstyle") diff --git a/layouts/shortcodes/expand.html b/layouts/shortcodes/expand.html index caa3d9561f..332c558184 100644 --- a/layouts/shortcodes/expand.html +++ b/layouts/shortcodes/expand.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- $version := split hugo.Version "." }} {{- $major := int (index $version 0) }} {{- $minor := int (index $version 1) }} diff --git a/layouts/shortcodes/icon.html b/layouts/shortcodes/icon.html index 80e60fd99a..55c57c56fc 100644 --- a/layouts/shortcodes/icon.html +++ b/layouts/shortcodes/icon.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/icon.html" (dict "context" .Page "icon" (.Get "icon" | default (.Get 0)) diff --git a/layouts/shortcodes/math.html b/layouts/shortcodes/math.html index 1e037bac43..1fe4af9fbc 100644 --- a/layouts/shortcodes/math.html +++ b/layouts/shortcodes/math.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/math.html" (dict "context" .Page "content" .Inner diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html index 1ff05523e3..4d22258db0 100644 --- a/layouts/shortcodes/mermaid.html +++ b/layouts/shortcodes/mermaid.html @@ -1,4 +1,3 @@ -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/mermaid.html" (dict "context" .Page "content" .Inner diff --git a/layouts/shortcodes/notice.html b/layouts/shortcodes/notice.html index a030da2f37..fe41a5de40 100644 --- a/layouts/shortcodes/notice.html +++ b/layouts/shortcodes/notice.html @@ -1,5 +1,3 @@ - -{{- $_hugo_config := `{ "version": 1 }` }} {{- partial "shortcodes/notice.html" (dict "context" .Page "color" (.Get "color")