Repository navigation
Feature: Configurable admonitions - #27
Conversation
|
I still suggest the following: Now that we've refactored the way custom admonitions are implemented, users should be able to customize admonitions in the simplest and most intuitive way. Otherwise, configuring or customizing admonitions would require handling them differently in separate places, which would unnecessarily raise the barrier to entry. |
|
For this config: admonition:
git:
icon: simple/git
color: '#f34f29'
example:
color: '#ff9800'Injected styles: <style>
:root{
--md-admonition-icon--git:url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M23.546%2010.93%2013.067.452a1.55%201.55%200%200%200-2.188%200L8.708%202.627l2.76%202.76a1.838%201.838%200%200%201%202.327%202.341l2.658%202.66a1.838%201.838%200%200%201%201.9%203.039%201.837%201.837%200%200%201-2.6%200%201.85%201.85%200%200%201-.404-1.996L12.86%208.955v6.525c.176.086.342.203.488.348a1.85%201.85%200%200%201%200%202.6%201.844%201.844%200%200%201-2.609%200%201.834%201.834%200%200%201%200-2.598c.182-.18.387-.316.605-.406V8.835a1.834%201.834%200%200%201-.996-2.41L7.636%203.7.45%2010.881c-.6.605-.6%201.584%200%202.189l10.48%2010.477a1.545%201.545%200%200%200%202.186%200l10.43-10.43a1.544%201.544%200%200%200%200-2.187%22/%3E%3C/svg%3E');
--md-admonition-color--git:#f34f29;
--md-admonition-color--example:#ff9800;
}
.md-typeset .admonition.git,.md-typeset details.git {
--md-admonition-icon:var(--md-admonition-icon--git);
--md-admonition-color:var(--md-admonition-color--git);
}
</style>
|
|
You can try it with: |
|
Okay, I'll give it a try in a bit. |
|
looks cool |
|
can conform it is working |
|
Alright, create the PR! |
|
@jaywhj I'd include both ways of costumization: config-based and css overriding. |
|
Then it would be great if you could update the documentation. |
|
Done. Please reaview it and tell me if you want to make any change. |
Nice work. There’s one more document that needs adjusting: line 105 in Change |

This PR adds the ability to configure custom admonition styles from
mkdocs|properdocs.yml.Previous work and discussions: