From 813dda273f123042a49df912f087ccb671b1db3d Mon Sep 17 00:00:00 2001
From: banteg <4562643+banteg@users.noreply.github.com>
Date: Wed, 14 Jan 2026 03:36:17 +0400
Subject: [PATCH 1/3] feat(admonitions): style custom types from extra
Signed-off-by: banteg <4562643+banteg@users.noreply.github.com>
---
dist/partials/icons.html | 94 ++++++++++++++++++++++++++++++++++++++
src/partials/icons.html | 99 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 193 insertions(+)
diff --git a/dist/partials/icons.html b/dist/partials/icons.html
index 3dc3cdaf..48d164ba 100644
--- a/dist/partials/icons.html
+++ b/dist/partials/icons.html
@@ -17,6 +17,100 @@
{% set _.style = _.style ~ "}\u003c/style\u003e" %}
{{ _.style }}
{% endif %}
+{% set admonition_icons = config.theme.icon.admonition | d({}, true) %}
+{% set admonition_extra = config.extra.admonitions | d({}, true) %}
+{% if admonition_extra is mapping %}
+ {% set _ = namespace(style = "\u003cstyle\u003e:root{", has_icon = false) %}
+ {% for type, data in admonition_extra | items %}
+ {% if type %}
+ {% if data is mapping %}
+ {% set icon = data.icon %}
+ {% else %}
+ {% set icon = data %}
+ {% endif %}
+ {% if icon %}
+ {% import ".icons/" ~ icon ~ ".svg" as icon %}
+ {% set _.style = _.style ~
+ "--md-admonition-icon--" ~ type ~ ":" ~
+ "url('data:image/svg+xml;charset=utf-8," ~
+ icon | replace("\n", "") | urlencode ~
+ "');"
+ %}
+ {% set _.has_icon = true %}
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+ {% if _.has_icon %}
+ {% set _.style = _.style ~ "}\u003c/style\u003e" %}
+ {{ _.style }}
+ {% endif %}
+{% endif %}
+{% set types = [] %}
+{% if admonition_icons is mapping %}
+ {% for type, icon in admonition_icons | items %}
+ {% if type and type not in types %}
+ {% set _ = types.append(type) %}
+ {% endif %}
+ {% endfor %}
+{% endif %}
+{% if admonition_extra is mapping %}
+ {% for type, data in admonition_extra | items %}
+ {% if type and type not in types %}
+ {% set _ = types.append(type) %}
+ {% endif %}
+ {% endfor %}
+{% endif %}
+{% if types %}
+
+{% endif %}
{% if config.theme.icon.annotation %}
{% set _ = namespace(style = "\u003cstyle\u003e:root{") %}
{% import ".icons/" ~ config.theme.icon.annotation ~ ".svg" as icon %}
diff --git a/src/partials/icons.html b/src/partials/icons.html
index dbb35dca..d116e077 100644
--- a/src/partials/icons.html
+++ b/src/partials/icons.html
@@ -41,6 +41,105 @@
{{ _.style }}
{% endif %}
+{% set admonition_icons = config.theme.icon.admonition | d({}, true) %}
+{% set admonition_extra = config.extra.admonitions | d({}, true) %}
+
+
+{% if admonition_extra is mapping %}
+ {% set _ = namespace(style = "\u003cstyle\u003e:root{", has_icon = false) %}
+ {% for type, data in admonition_extra | items %}
+ {% if type %}
+ {% if data is mapping %}
+ {% set icon = data.icon %}
+ {% else %}
+ {% set icon = data %}
+ {% endif %}
+ {% if icon %}
+ {% import ".icons/" ~ icon ~ ".svg" as icon %}
+ {% set _.style = _.style ~
+ "--md-admonition-icon--" ~ type ~ ":" ~
+ "url('data:image/svg+xml;charset=utf-8," ~
+ icon | replace("\n", "") | urlencode ~
+ "');"
+ %}
+ {% set _.has_icon = true %}
+ {% endif %}
+ {% endif %}
+ {% endfor %}
+ {% if _.has_icon %}
+ {% set _.style = _.style ~ "}\u003c/style\u003e" %}
+ {{ _.style }}
+ {% endif %}
+{% endif %}
+
+
+{% set types = [] %}
+{% if admonition_icons is mapping %}
+ {% for type, icon in admonition_icons | items %}
+ {% if type and type not in types %}
+ {% set _ = types.append(type) %}
+ {% endif %}
+ {% endfor %}
+{% endif %}
+{% if admonition_extra is mapping %}
+ {% for type, data in admonition_extra | items %}
+ {% if type and type not in types %}
+ {% set _ = types.append(type) %}
+ {% endif %}
+ {% endfor %}
+{% endif %}
+{% if types %}
+
+{% endif %}
+
{% if config.theme.icon.annotation %}
{% set _ = namespace(style = "\u003cstyle\u003e:root{") %}
From 35dc961b2accba5018cb7becd4b1c1f4ca2c985a Mon Sep 17 00:00:00 2001
From: banteg <4562643+banteg@users.noreply.github.com>
Date: Wed, 14 Jan 2026 04:14:11 +0400
Subject: [PATCH 2/3] fix(ui): harden custom admonition styles
Signed-off-by: banteg <4562643+banteg@users.noreply.github.com>
---
dist/partials/icons.html | 100 +++++++++++++++++-------------------
src/partials/icons.html | 107 ++++++++++++++++++---------------------
2 files changed, 95 insertions(+), 112 deletions(-)
diff --git a/dist/partials/icons.html b/dist/partials/icons.html
index 48d164ba..a741ccbb 100644
--- a/dist/partials/icons.html
+++ b/dist/partials/icons.html
@@ -1,64 +1,59 @@
{#-
This file was automatically generated - do not edit
-#}
-{% if config.theme.icon.admonition %}
- {% set _ = namespace(style = "\u003cstyle\u003e:root{") %}
- {% for type, icon in config.theme.icon.admonition | items %}
- {% if type and icon %}
- {% import ".icons/" ~ icon ~ ".svg" as icon %}
- {% set _.style = _.style ~
- "--md-admonition-icon--" ~ type ~ ":" ~
- "url('data:image/svg+xml;charset=utf-8," ~
- icon | replace("\n", "") | urlencode ~
- "');"
- %}
+{% set admonition_icons = config.theme.icon.admonition | d({}, true) %}
+{% set admonition_extra = config.extra.admonitions | d({}, true) %}
+{% set types = [] %}
+{% if admonition_icons is mapping %}
+ {% for type, icon in admonition_icons | items %}
+ {% if type and icon and type not in types %}
+ {% set _ = types.append(type) %}
{% endif %}
{% endfor %}
- {% set _.style = _.style ~ "}\u003c/style\u003e" %}
- {{ _.style }}
{% endif %}
-{% set admonition_icons = config.theme.icon.admonition | d({}, true) %}
-{% set admonition_extra = config.extra.admonitions | d({}, true) %}
{% if admonition_extra is mapping %}
- {% set _ = namespace(style = "\u003cstyle\u003e:root{", has_icon = false) %}
{% for type, data in admonition_extra | items %}
- {% if type %}
+ {% if type and type not in types %}
{% if data is mapping %}
- {% set icon = data.icon %}
+ {% set has_data = data.icon or data.color %}
{% else %}
- {% set icon = data %}
+ {% set has_data = data %}
{% endif %}
- {% if icon %}
- {% import ".icons/" ~ icon ~ ".svg" as icon %}
- {% set _.style = _.style ~
- "--md-admonition-icon--" ~ type ~ ":" ~
- "url('data:image/svg+xml;charset=utf-8," ~
- icon | replace("\n", "") | urlencode ~
- "');"
- %}
- {% set _.has_icon = true %}
+ {% if has_data %}
+ {% set _ = types.append(type) %}
{% endif %}
{% endif %}
{% endfor %}
- {% if _.has_icon %}
- {% set _.style = _.style ~ "}\u003c/style\u003e" %}
- {{ _.style }}
- {% endif %}
{% endif %}
-{% set types = [] %}
-{% if admonition_icons is mapping %}
- {% for type, icon in admonition_icons | items %}
- {% if type and type not in types %}
- {% set _ = types.append(type) %}
+{% if types %}
+ {% set _ = namespace(style = "\u003cstyle\u003e:root{", has_icon = false) %}
+ {% for type in types %}
+ {% set data = admonition_extra.get(type) if admonition_extra is mapping else None %}
+ {% if data is mapping %}
+ {% set icon = data.icon %}
+ {% elif data %}
+ {% set icon = data %}
+ {% else %}
+ {% set icon = None %}
{% endif %}
- {% endfor %}
-{% endif %}
-{% if admonition_extra is mapping %}
- {% for type, data in admonition_extra | items %}
- {% if type and type not in types %}
- {% set _ = types.append(type) %}
+ {% if not icon and admonition_icons is mapping %}
+ {% set icon = admonition_icons.get(type) %}
+ {% endif %}
+ {% if icon %}
+ {% import ".icons/" ~ icon ~ ".svg" as icon %}
+ {% set _.style = _.style ~
+ "--md-admonition-icon--" ~ type ~ ":" ~
+ "url('data:image/svg+xml;charset=utf-8," ~
+ icon | replace("\n", "") | urlencode ~
+ "');"
+ %}
+ {% set _.has_icon = true %}
{% endif %}
{% endfor %}
+ {% if _.has_icon %}
+ {% set _.style = _.style ~ "}\u003c/style\u003e" %}
+ {{ _.style }}
+ {% endif %}
{% endif %}
{% if types %}