mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 07:18:57 +00:00
28 lines
963 B
HTML
28 lines
963 B
HTML
{{- $basicTypes := slice "note" "tip" "important" "warning" "caution" -}}
|
|
|
|
{{- if eq .AlertType "center" -}}
|
|
{{- /* The "center" type is a special case for centering content. */ -}}
|
|
<blockquote class="blockquote-center">{{ .Text }}</blockquote>
|
|
{{- else if .AlertTitle | or .AlertSign | or (.AlertType | in $basicTypes | not) -}}
|
|
{{- /* The extended syntax is compatible with Obsidian and FixIt admonition shortcode. */ -}}
|
|
{{- $openMap := dict "+" true "-" false -}}
|
|
{{- $open := index $openMap .AlertSign | default true -}}
|
|
{{- $foldable := ne .AlertSign "" -}}
|
|
{{- dict
|
|
"Type" .AlertType
|
|
"Title" .AlertTitle
|
|
"Open" $open
|
|
"Text" .Text
|
|
"Foldable" $foldable
|
|
| partial "plugin/admonition.html"
|
|
-}}
|
|
{{- else -}}
|
|
{{- /* The basic syntax is compatible with GitHub, Obsidian, and Typora. */ -}}
|
|
{{- dict
|
|
"Type" .AlertType
|
|
"Text" .Text
|
|
"Attributes" .Attributes
|
|
| partial "plugin/alert.html"
|
|
-}}
|
|
{{- end -}}
|