feat: data-driven custom admonitions #42
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Approach
This PR makes custom admonitions data‑driven and open‑ended in the UI while staying compatible with MiniJinja and existing theme semantics:
1) Consume arbitrary admonition types from config
config.extra.admonitionsfor icon/color definitions.todo = "lucide/list-todo") and mapping (todo = { icon = "…", color = "…" }).config.theme.icon.admonition(opened up in core PR) for icon‑only overrides.extra.admonitions.iconwhen present, otherwise falling back totheme.icon.admonition.2) Generate CSS for any type (no closed set)
--md-admonition-icon--<type>with inlined SVG data.:is(.admonition, details).<type>.3) Make templates MiniJinja‑safe
list.appendwithnamespace+ list concatenation.dict.getwithinchecks and direct indexing.4) Match theme variants
5) Keep dist artifacts in sync
src/partials/icons.htmlanddist/partials/icons.html.Files changed
src/partials/icons.htmldist/partials/icons.htmlBehavior changes
extra.admonitions.<type>now produces a styled admonition with icon/color.theme.icon.admonition.<type>now provides icon‑only customization.Cross‑repo context
theme.icon.admonitionas a map and removes fixed defaults.Testing
Scope notes
!!! type "Title").