feat(i18n): add i18n support for Markdown alert (#1269)

* docs: add blockquote with custom alert title

* feat: add alert types to i18n and update blockquote rendering

* fix: wrong translation key

* feat: add alert title translation for all supported languages

Done by AI
This commit is contained in:
Jimmy
2026-02-18 20:07:59 +01:00
committed by GitHub
parent 470295171e
commit 3a0d70ebbd
35 changed files with 254 additions and 18 deletions
+18 -12
View File
@@ -1,20 +1,26 @@
{{- $type := .AlertType -}}
{{- $icons := site.Params.article.alertIcon -}}
{{- $icon := index $icons $type -}}
<blockquote class="{{ if $type }}alert alert-{{ $type }}{{ end }}">
{{- if $type -}}
{{ if eq .Type "alert" }}
{{- $type := .AlertType -}}
{{- $icons := site.Params.article.alertIcon -}}
{{- $icon := index $icons $type -}}
<blockquote class="alert alert-{{ $type }}">
<div class="alert-header">
<span class="alert-icon">
{{- $icon -}}
</span>
<span class="alert-title">
{{- title $type -}}
{{- with .AlertTitle -}}
{{ . }}
{{- else -}}
{{ or (i18n (printf "article.alert.%s" $type)) (title $type) }}
{{- end -}}
</span>
</div>
{{- end -}}
<div class="alert-body">
<div class="alert-body">
{{ .Text }}
</div>
</blockquote>
{{ else }}
<blockquote>
{{ .Text }}
</div>
</blockquote>
</blockquote>
{{ end }}