mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
⚡ Perf: if .AlertType not in basic types, rendering to extended alert syntax
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
{{- if .AlertTitle -}}
|
||||
{{- $basicTypes := slice "note" "tip" "important" "warning" "caution" -}}
|
||||
|
||||
{{- if .AlertTitle | or .AlertSign | or (.AlertType | in $basicTypes | not) -}}
|
||||
{{- /* The extended syntax is compatible with Obsidian and FixIt admonition shortcode. */ -}}
|
||||
{{- /* === Dirty hack === */ -}}
|
||||
{{- /* BUG of Hugo https://github.com/gohugoio/hugo/issues/12913 */ -}}
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
*/ -}}
|
||||
|
||||
{{- $iconMap := dict
|
||||
"caution" "images/icons/alerts/stop.svg"
|
||||
"important" "images/icons/alerts/report.svg"
|
||||
"note" "images/icons/alerts/info.svg"
|
||||
"tip" "images/icons/alerts/light-bulb.svg"
|
||||
"important" "images/icons/alerts/report.svg"
|
||||
"warning" "images/icons/alerts/alert.svg"
|
||||
"caution" "images/icons/alerts/stop.svg"
|
||||
-}}
|
||||
|
||||
{{- $attrs := "" }}
|
||||
|
||||
Reference in New Issue
Block a user