Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
5 tasks done
locomoco28 opened this issue Jun 4, 2022 · 3 comments
Closed
5 tasks done

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

locomoco28 opened this issue Jun 4, 2022 · 3 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@locomoco28
Copy link

locomoco28 commented Jun 4, 2022

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)

@squidfunk squidfunk added needs investigation Issue must be investigated by the maintainers bug Issue reports a bug and removed needs investigation Issue must be investigated by the maintainers labels Jun 4, 2022
@squidfunk
Copy link
Owner

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.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Jun 5, 2022
@squidfunk
Copy link
Owner

Released as part of 8.3.2.

@locomoco28
Copy link
Author

Thanks for the quick fix, very much appreciated <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants