mirror of
https://github.com/imfing/hextra.git
synced 2025-08-24 02:47:08 -04:00
feat: implement github style alert
This commit is contained in:
@@ -1,20 +1,9 @@
|
||||
{{- $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) -}}
|
||||
{{- if not (in (slice "note" "tip" "important" "warning" "caution") .AlertType) -}}
|
||||
{{- warnf "Alert type %s is not supported" .AlertType -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $content := .Text -}}
|
||||
{{- $alertType := .AlertType -}}
|
||||
{{- $alertTitle := .AlertTitle -}}
|
||||
|
||||
{{- partial "components/github-style-alert.html" (dict "content" $content "alertType" $alertType "alertTitle" $alertTitle) -}}
|
||||
|
Reference in New Issue
Block a user