From 4fccd06b78babf6e009cad753648f0640bbead46 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Mon, 27 Mar 2023 17:24:56 +0200 Subject: [PATCH] Allow overriding all inlined icons via yaml only --- material/base.html | 6 ++++-- material/mkdocs_theme.yml | 4 ++-- material/partials/footer.html | 6 ++++-- material/partials/header.html | 6 ++++-- material/partials/search.html | 12 ++++++++---- src/base.html | 6 ++++-- src/mkdocs_theme.yml | 4 ++-- src/partials/footer.html | 6 ++++-- src/partials/header.html | 6 ++++-- src/partials/search.html | 12 ++++++++---- 10 files changed, 44 insertions(+), 24 deletions(-) diff --git a/material/base.html b/material/base.html index b4ca1ce04..b3860fc3e 100644 --- a/material/base.html +++ b/material/base.html @@ -108,7 +108,8 @@
{% if "announce.dismiss" in features %} {% endif %} {% block announce %}{% endblock %} @@ -184,7 +185,8 @@
{% if "navigation.top" in features %} {% endif %} diff --git a/material/mkdocs_theme.yml b/material/mkdocs_theme.yml index a1790e907..0c9653034 100644 --- a/material/mkdocs_theme.yml +++ b/material/mkdocs_theme.yml @@ -48,8 +48,8 @@ font: # Fixed-width font for code listings code: Roboto Mono -# From Material 5.x on, icons are inlined into the HTML and CSS as SVGs. Some -# icons that are part of the HTML can be configured and replaced +# From Material 5.x on, icons are inlined into the HTML and CSS as SVGs. +# Icons that are part of the HTML can be configured and replaced icon: # Favicon to be rendered diff --git a/material/partials/footer.html b/material/partials/footer.html index 6afb8f43e..79e312676 100644 --- a/material/partials/footer.html +++ b/material/partials/footer.html @@ -12,7 +12,8 @@ {% set direction = lang.t("footer.previous") %} {% endif %} diff --git a/material/partials/header.html b/material/partials/header.html index 89f9513be..9a7bd6e94 100644 --- a/material/partials/header.html +++ b/material/partials/header.html @@ -13,7 +13,8 @@ {% include "partials/logo.html" %}
@@ -69,7 +70,8 @@ {% endif %} {% if "material/search" in config.plugins %} {% include "partials/search.html" %} {% endif %} diff --git a/material/partials/search.html b/material/partials/search.html index daf177295..4ad3b36fa 100644 --- a/material/partials/search.html +++ b/material/partials/search.html @@ -7,17 +7,21 @@
{% if "search.suggest" in features %} diff --git a/src/base.html b/src/base.html index 5bafbb145..71555c5ec 100644 --- a/src/base.html +++ b/src/base.html @@ -223,7 +223,8 @@ class="md-banner__button md-icon" aria-label="{{ lang.t('announce.dismiss') }}" > - {% include ".icons/material/close.svg" %} + {% set icon = config.theme.icon.close or "material/close" %} + {% include ".icons/" ~ icon ~ ".svg" %} {% endif %} @@ -340,7 +341,8 @@ data-md-component="top" hidden > - {% include ".icons/material/arrow-up.svg" %} + {% set icon = config.theme.icon.top or "material/arrow-up" %} + {% include ".icons/" ~ icon ~ ".svg" %} {{ lang.t("top") }} {% endif %} diff --git a/src/mkdocs_theme.yml b/src/mkdocs_theme.yml index a1790e907..0c9653034 100644 --- a/src/mkdocs_theme.yml +++ b/src/mkdocs_theme.yml @@ -48,8 +48,8 @@ font: # Fixed-width font for code listings code: Roboto Mono -# From Material 5.x on, icons are inlined into the HTML and CSS as SVGs. Some -# icons that are part of the HTML can be configured and replaced +# From Material 5.x on, icons are inlined into the HTML and CSS as SVGs. +# Icons that are part of the HTML can be configured and replaced icon: # Favicon to be rendered diff --git a/src/partials/footer.html b/src/partials/footer.html index f04455fbc..665b455fe 100644 --- a/src/partials/footer.html +++ b/src/partials/footer.html @@ -45,7 +45,8 @@ rel="prev" >
{% endif %} diff --git a/src/partials/header.html b/src/partials/header.html index d8a6e910a..1bc98b1eb 100644 --- a/src/partials/header.html +++ b/src/partials/header.html @@ -48,7 +48,8 @@ @@ -138,7 +139,8 @@ {% if "material/search" in config.plugins %} diff --git a/src/partials/search.html b/src/partials/search.html index 7987456bc..1854a7d36 100644 --- a/src/partials/search.html +++ b/src/partials/search.html @@ -43,8 +43,10 @@ @@ -65,7 +67,8 @@ data-md-component="search-share" tabindex="-1" > - {% include ".icons/material/share-variant.svg" %} + {% set icon = config.theme.icon.share or "material/share-variant" %} + {% include ".icons/" ~ icon ~ ".svg" %} {% endif %} @@ -77,7 +80,8 @@ aria-label="{{ lang.t('search.reset') }}" tabindex="-1" > - {% include ".icons/material/close.svg" %} + {% set icon = config.theme.icon.close or "material/close" %} + {% include ".icons/" ~ icon ~ ".svg" %}