{{- if eq .Type "alert" -}}
{{- $typeMap := dict
"summary" "abstract"
"tldr" "abstract"
"hint" "tip"
"check" "success"
"done" "success"
"help" "question"
"faq" "question"
"attention" "warning"
"fail" "failure"
"missing" "failure"
"error" "danger"
"cite" "quote"
-}}
{{- $iconMap := dict
"note" "circle-info"
"abstract" "file-lines"
"info" "circle-info"
"todo" "list-check"
"tip" "lightbulb"
"important" "star"
"success" "check"
"question" "circle-question"
"warning" "triangle-exclamation"
"caution" "triangle-exclamation"
"failure" "xmark"
"danger" "fire"
"bug" "bug"
"example" "list-ol"
"quote" "quote-left"
-}}
{{- $rawType := .AlertType | lower -}}
{{- $normalizedType := index $typeMap $rawType | default $rawType -}}
{{- $iconName := index $iconMap $normalizedType | default "circle-info" -}}
{{- $contentText := .Text | plainify | strings.TrimSpace -}}
{{- $hasContent := ne $contentText "" -}}
{{- $isHeaderOnly := not $hasContent -}}
{{- $title := .AlertTitle -}}
{{- if not $title -}}
{{- $i18nKey := printf "admonition.%s" $normalizedType -}}
{{- $i18nTitle := i18n $i18nKey -}}
{{- if and $i18nTitle (ne $i18nTitle $i18nKey) -}}
{{- $title = $i18nTitle -}}
{{- else -}}
{{- $title = title $normalizedType -}}
{{- end -}}
{{- end -}}
{{- $containerClass := "admonition relative overflow-hidden rounded-lg border-l-4 px-4 py-3 shadow-sm print:break-inside-avoid" -}}
{{- if $isHeaderOnly -}}
{{- $containerClass = printf "%s admonition--header-only" $containerClass -}}
{{- end -}}
{{- $headerClass := "admonition-header flex items-center gap-2 font-semibold text-inherit" -}}
{{- $contentClass := "admonition-content text-base leading-relaxed text-inherit" -}}
{{- if $hasContent -}}
{{- $contentClass = printf "%s mt-3" $contentClass -}}
{{- end -}}
{{- $isCollapsible := and $hasContent (in (slice "+" "-") .AlertSign) -}}
{{- if $isCollapsible -}}
{{- .Text | safeHTML -}}{{- end -}}