feat: basic github style alerts support

This commit is contained in:
Xin
2024-12-14 17:27:33 +00:00
parent 4c4f43779c
commit 672179fe70
4 changed files with 65 additions and 32 deletions

View File

@@ -0,0 +1,20 @@
{{- $supportedAlertTypes := slice "note" "tip" "important" "warning" "caution" -}}
{{- $emojis := dict
"note" ":memo:"
"tip" ":bulb:"
"important" ":information_source:"
"warning" ":warning:"
"caution" ":exclamation:"
-}}
{{- if not (in $supportedAlertTypes .AlertType) -}}
<blockquote>
{{- .Text -}}
</blockquote>
{{- else -}}
{{- $emoji := emojify (index $emojis .AlertType) -}}
{{- $content := .Text -}}
{{- $icon := "" -}}
{{- $class := "" -}}
{{- partial "shortcodes/callout.html" (dict "content" $content "emoji" $emoji "icon" $icon "class" $class) -}}
{{- end -}}

View File

@@ -0,0 +1,3 @@
<blockquote>
{{ .Text }}
</blockquote>