Files
Cell 5f1e79f49c feat(i18n): add RTL support for Arabic, Persian and Urdu (#831)
* feat(i18n): add RTL support and Arabic/Persian translations

- Add `dir` attribute to `<html>` via `.Site.Language.Direction`
- Convert physical CSS properties to logical properties across ~30 SCSS files
- Add `[dir="rtl"]` overrides for elements that need physical direction (code blocks, translate, icons)
- Add `logical-direction.html` template function for config value normalization
- Add RTL-aware deprecation warnings for old "left"/"right" config values
- Rename github corner, TOC position, reading progress config values from "left"/"right" to "start"/"end"
- Add Arabic (ar.toml) and Persian (fa.toml) i18n translation files
- Update multilingual documentation with RTL language configuration guide

* feat(shortcodes): add RTL support for tabs and refactor border-radius mixin

- Rename tabs placement values from "left"/"right" to "start"/"end" with deprecation warnings
- Convert all physical directional properties in tabs SCSS to logical properties
- Add RTL overrides for translate and box-shadow in tabs
- Add "start"/"end" support to border-radius mixin using CSS logical properties
- Refactor fixit-decryptor to use border-radius(start/end) mixin

* feat(assets): add RTL support for toc-dialog slide animation

The mobile toc-dialog always slid in from the right (100vw). In RTL
mode it should slide from the left (-100vw), matching the
border-inline-start/margin-inline-end anchoring.

* feat(assets): add RTL support for post-tag comma separator

* refactor(assets): extract RTL styles into dedicated _rtl.scss

* feat(assets): add RTL support for theme-switch and directional icons

* feat(i18n): add RTL support and improve i18n

- Add RTL typography corrections for Arabic-script languages (:lang(ar/fa/ur))
- Remove fa-list-ol from RTL flip list (numbers get mirrored)
- Add Urdu translation file (i18n/ur.toml)
- Rename noMoretTranslations to noTranslations and simplify all translations
- Update json-viewer-element from 1.0.4 to 1.0.6
- Add RTL test posts (index.en.md, index.ar.md)
- Fix layout partials for RTL support

See https://fixit.lruihao.cn/docs/content-management/introduction/#rtl-language-support
2026-08-24 00:22:34 +08:00

72 lines
2.4 KiB
HTML

{{- /*
Admonition box rendering partial.
The extended syntax of alert is compatible with Obsidian and FixIt admonition shortcode.
@param {String} .Text - The content of the admonition box
@param {String} [.Type] - The type of the admonition box
@param {String} [.Title] - The title of the admonition box
@param {Boolean} [.Open] - Whether the admonition box is open, default is true
@param {Boolean} [.Foldable] - Whether the admonition box is foldable, default is true
For custom admonitions, see https://fixit.lruihao.cn/docs/content-management/shortcodes/extended/admonition/#customize-admonitions
*/ -}}
{{- $iconMap := dict
"note" "fa-solid fa-pencil"
"abstract" "fa-solid fa-clipboard-list"
"info" "fa-solid fa-circle-info"
"todo" "fa-solid fa-list-check"
"tip" "fa-regular fa-lightbulb"
"success" "fa-solid fa-check"
"question" "fa-regular fa-circle-question"
"warning" "fa-solid fa-exclamation-triangle"
"failure" "fa-solid fa-xmark"
"danger" "fa-solid fa-bolt"
"bug" "fa-solid fa-bug"
"example" "fa-solid fa-list-ul"
"quote" "fa-solid fa-quote-right"
-}}
{{- /* Custom admonitions */ -}}
{{- $iconMap = site.Params.admonition | merge $iconMap -}}
{{- $aliasMap := dict
"summary" "abstract"
"tldr" "abstract"
"hint" "tip"
"important" "tip"
"check" "success"
"done" "success"
"help" "question"
"faq" "question"
"caution" "warning"
"attention" "warning"
"fail" "failure"
"missing" "failure"
"error" "danger"
"cite" "quote"
-}}
{{- $type := .Type | lower -}}
{{- $type = index $aliasMap $type | default $type | default "note" -}}
{{- $icon := index $iconMap $type | default "fa-solid fa-pencil" -}}
{{- $title := .Title | default (T (printf "admonition.%v" $type)) | default (title $type) -}}
{{- $titleless := eq .Title "~" -}}
{{- $foldable := ne .Foldable false -}}
<div class="details admonition {{ $type }}{{ if .Open | ne false }} open{{ end }}{{ if not $foldable }} disabled{{ end }}">
{{- if not $titleless }}
<div class="details-summary admonition-title">
{{- dict "Class" (add "icon " $icon) | partial "plugin/icon.html" -}}
{{- $title | safeHTML -}}
{{- if $foldable -}}
{{- dict "Class" "details-icon fa-solid fa-angle-right" | partial "plugin/icon.html" -}}
{{- end -}}
</div>
{{- end }}
{{- with .Text -}}
<div class="details-content">
<div class="admonition-content">
{{- . | safeHTML -}}
</div>
</div>
{{- end }}
</div>
{{- /* EOF */ -}}