chore: add inline shortcode icon

* enable `enableInlineShortcodes` in config
* add markdown icon
* update hugo stats json
* clean up mermaid template
This commit is contained in:
Xin 2023-08-18 00:16:49 +01:00
parent 60ac09cd1a
commit 2b7b5622aa
5 changed files with 17 additions and 1 deletions

View File

@ -33,6 +33,7 @@ one: <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="-1 0 1
cards: <svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.246 2.246 0 0 0-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"></path></svg>
copy: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>
hamburger-menu: <svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><g><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 8H20"></path></g><g><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16H20"></path></g></svg>
markdown: <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M20.56 18H3.44C2.65 18 2 17.37 2 16.59V7.41C2 6.63 2.65 6 3.44 6h17.12c.79 0 1.44.63 1.44 1.41v9.18c0 .78-.65 1.41-1.44 1.41M6.81 15.19v-3.66l1.92 2.35l1.92-2.35v3.66h1.93V8.81h-1.93l-1.92 2.35l-1.92-2.35H4.89v6.38h1.92M19.69 12h-1.92V8.81h-1.92V12h-1.93l2.89 3.28L19.69 12Z"/></svg>
# Icons from heroicons v1 outlined https://github.com/tailwindlabs/heroicons/tree/v1
academic-cap: <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true"><path d="M12 14l9-5-9-5-9 5 9 5z"/><path d="M12 14l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14z"/><path stroke-linecap="round" stroke-linejoin="round" d="M12 14l9-5-9-5-9 5 9 5zm0 0l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14zm-4 6v-7.5l4-2.222"/></svg>

View File

@ -38,6 +38,8 @@ markup:
highlight:
noClasses: false
enableInlineShortcodes: true
menu:
main:
- name: Documentation

View File

@ -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",

View File

@ -2,4 +2,3 @@
{{- .Inner | safeHTML -}}
</pre>
{{- .Page.Store.Set "hasMermaid" true -}}
{{ warnf .Page.RelPermalink }}

View File

@ -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 "<svg" (printf "<svg %s" $attributes) $icon -}}
<span class="inline-block align-text-bottom icon">
{{- $icon | safeHTML -}}
</span>