From 2b7b5622aa1ee22bda7154a6f1e1f5f165c3fb62 Mon Sep 17 00:00:00 2001 From: Xin Date: Fri, 18 Aug 2023 00:16:49 +0100 Subject: [PATCH] chore: add inline shortcode icon * enable `enableInlineShortcodes` in config * add markdown icon * update hugo stats json * clean up mermaid template --- data/icons.yaml | 1 + exampleSite/hugo.yaml | 2 ++ exampleSite/hugo_stats.json | 2 ++ .../_default/_markup/render-codeblock-mermaid.html | 1 - layouts/shortcodes/icon.html | 12 ++++++++++++ 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 layouts/shortcodes/icon.html diff --git a/data/icons.yaml b/data/icons.yaml index 8a60d9f..21c70cd 100644 --- a/data/icons.yaml +++ b/data/icons.yaml @@ -33,6 +33,7 @@ one: copy: hamburger-menu: +markdown: # Icons from heroicons v1 outlined https://github.com/tailwindlabs/heroicons/tree/v1 academic-cap: diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 69c5eba..2c9fa1a 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -38,6 +38,8 @@ markup: highlight: noClasses: false +enableInlineShortcodes: true + menu: main: - name: Documentation diff --git a/exampleSite/hugo_stats.json b/exampleSite/hugo_stats.json index 991d274..f59b6f2 100644 --- a/exampleSite/hugo_stats.json +++ b/exampleSite/hugo_stats.json @@ -69,6 +69,7 @@ "active:opacity-50", "active:shadow-gray-200", "active:shadow-sm", + "align-text-bottom", "appearance-none", "before:absolute", "before:bg-gray-200", @@ -248,6 +249,7 @@ "hover:text-gray-800", "hover:text-gray-900", "hover:text-primary-600", + "icon", "inline", "inline-block", "inline-flex", diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html index 611b088..fc15feb 100644 --- a/layouts/_default/_markup/render-codeblock-mermaid.html +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -2,4 +2,3 @@ {{- .Inner | safeHTML -}} {{- .Page.Store.Set "hasMermaid" true -}} -{{ warnf .Page.RelPermalink }} diff --git a/layouts/shortcodes/icon.html b/layouts/shortcodes/icon.html new file mode 100644 index 0000000..3478914 --- /dev/null +++ b/layouts/shortcodes/icon.html @@ -0,0 +1,12 @@ +{{- $icon := index site.Data.icons (.Get 0) -}} +{{- $attributes := "height=1em"}} + +{{- if not $icon -}} + {{ errorf "icon %q not found" (.Get 0) }} +{{- end -}} + +{{- $icon = replaceRE " + {{- $icon | safeHTML -}} +