question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Admonition icons break with 5.x

See original GitHub issue

I checked that…

  • … the documentation does not mention anything about my problem
  • N/A … the problem doesn’t occur with the default MkDocs template
  • … the problem is not in any of my customizations (CSS, JS, template)
  • … there are no open or closed issues that are related to my problem

Description

Previously, guidance was provided on using custom css to override icons used in the admonition, as shown in #646. However, the use of CSS variables seems to prevent the old method from working.

Expected behavior

A replacement technique for overriding the icon assigned to a chosen admonition type should be provided.

Actual behavior

Previously accepted/recommended technique does not change the icon - only the defaults are displayed.

Steps to reproduce the bug

  1. Use previous CSS methods in custom css file, e.g:
.md-typeset .admonition.bug > .admonition-title::before, .md-typeset .admonition.bug > summary::before, .md-typeset .admonition.important > .admonition-title::before, .md-typeset .admonition.important > summary::before, .md-typeset .admonition.bug > .admonition-title::before, .md-typeset .admonition.bug > summary::before, .md-typeset details.hint > .admonition-title::before, .md-typeset details.hint > summary::before, .md-typeset details.important > .admonition-title::before, .md-typeset details.important > summary::before, .md-typeset details.bug > .admonition-title::before, .md-typeset details.bug > summary::before {
    color: rgb(245, 0, 87);
    content: "play_circle_outline";
}

Package versions

  • Python: python --version: Python 3.7.5
  • MkDocs: mkdocs --version: mkdocs, version 1.1 from /usr/local/lib/python3.7/site-packages/mkdocs (Python 3.7)
  • Material: pip show mkdocs-material | grep -E ^Version: Version: 5.1.4

Project configuration

...
theme:
  name: 'material'
  font:
    text: 'Calibri'
    code: 'Courier New'
  palette:
    primary: 'white'
    accent: 'indigo'
  icon:
    logo: material/view-dashboard
  favicon: 'img/favicon.ico'
  features:
  - instant
#   - tabs

markdown_extensions:
  - admonition
...

System information

  • OS: MacOS 10.15.4
  • Browser: Chrome 81.0.4044.129

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
facelessusercommented, May 1, 2020

It is definitely a CSS question as this is completely controlled via CSS. The example I posted is obviously more complicated than desired for easy understanding, unfortunately it is all I have time for at the moment until I’m moved. I don’t mind offering a simple example, but it has to be as soon as I have time. I know last time, I think I was offering the guidance as well.

0reactions
squidfunkcommented, May 1, 2020

Technically, #646 was a feature request, not a support request. I hope that GitHub discussions is out of beta soon, as I think this project would massively benefit from it.😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

Awesome Asciidoctor: Using Admonition Icons On GitHub
In the following example we assign icons to the different admonitions: ? 1. 2. 3. 4. 5. 6.
Read more >
Admonitions - Material for MkDocs
Each of the supported admonition types has a distinct icon, which can be changed to any icon bundled with the theme, or even...
Read more >
Admonitions | Asciidoctor Docs
This page introduces you to admonition types AsciiDoc provides, how to add admonitions to your document, and how to enhance them using icons...
Read more >
Enable display of admonition icons in Asciidoc. - GitLab.org
Enables admonition icons to display in rendered asciidoc documents. ... Not sure what you mean by this would break everybody's else local branches...
Read more >
feat: add optional hint/admonition icons (#383) · f6966b8513
By default, the admonition is rendered with a plain text label. To enable font icons the document attribute `:icons: font` need to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found