squidfunk / mkdocs-material

Documentation that simply works

Home Page:https://squidfunk.github.io/mkdocs-material/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom admonition icons don't work when defining theme.palette

locomoco28 opened this issue · comments

commented

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

When trying to specify a custom icon for admonitions, the icons are not replaced when the mkdocs.yml also has theme.palette defined.

Expected behaviour

After commenting out the theme.palette key, we can see the expected behavior

image

Actual behaviour

The icon does not get replaced when specifying the theme.palette key

image

Steps to reproduce

Deploy the following example page using the mkdocs.yml specified below

<!-- docs/index.md -->
!!! note
    This is an example note

Package versions

  • Python: 3.8.13
  • MkDocs: 1.3.0
  • Material: 8.3.1

Configuration

# mkdocs.yml
site_name: "Example mkdocs material"

theme:
  name: material
  palette: # <- this is the culprit, commenting it out fixes the issue, but we use need it for dark/bright mode configuration
    scheme: default
  icon:
    admonition:
      note: octicons/alert-24
    logo: material/cloud

markdown_extensions:
  - admonition
  - pymdownx.details
  - pymdownx.superfences

System information

Locally using Win 10 and also in a newly created Gitpod.io workspace (cloud VS Code IDE)

Thanks for reporting! Fixed in 7998dbf. The problem was that we used SASS' selector extension feature to allow defining [data-md-color-scheme=default] on nested content, so you can put any element into dark or light mode. Since we extended :root, all definitions where carried over to [data-md-color-scheme=default], including those of admonition icons. The linked commit moves definitions into a placeholder to keep things separate.

Released as part of 8.3.2.

commented

Thanks for the quick fix, very much appreciated <3