Skip to content

Commit 29f00a5

Browse files
committed
Modernized look of admonitions
1 parent 6edbcf8 commit 29f00a5

File tree

6 files changed

+70
-19
lines changed

6 files changed

+70
-19
lines changed

docs/reference/admonitions.md

+40
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,46 @@ the default type, and thus fallback for unknown type qualifiers, is `note`:
388388

389389
## Customization
390390

391+
### Classic admonitions
392+
393+
Prior to version [:octicons-tag-24: 8.6.0][Admonition modern], admonitions had
394+
a slightly different appearance:
395+
396+
!!! classic "Note"
397+
398+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
399+
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
400+
massa, nec semper lorem quam in massa.
401+
402+
If you want to restore this appearance, add the following CSS to an
403+
[additional style sheet]:
404+
405+
<style>
406+
.md-typeset .admonition.classic {
407+
border-width: 0;
408+
border-left-width: 4px;
409+
}
410+
</style>
411+
412+
=== ":octicons-file-code-16: `docs/stylesheets/extra.css`"
413+
414+
``` css
415+
.md-typeset .admonition,
416+
.md-typeset details {
417+
border-width: 0;
418+
border-left-width: 4px;
419+
}
420+
```
421+
422+
=== ":octicons-file-code-16: `mkdocs.yml`"
423+
424+
``` yaml
425+
extra_css:
426+
- stylesheets/extra.css
427+
```
428+
429+
[Admonition modern]: https://github.com/squidfunk/mkdocs-material/releases/tag/8.6.0
430+
391431
### Custom admonitions
392432

393433
If you want to add a custom admonition type, all you need is a color and an

docs/setup/setting-up-tags.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The following configuration options are available:
3232
3333
[`tags_file`](#+tags.tags_file){ #+tags.tags_file }
3434

35-
: :octicons-milestone-24: Default: _none_ – This option specifies which file
35+
: :octicons-milestone-24: Default: _none_ – This option specifies which page
3636
should be used to render the tags index. See the section on [adding a tags
3737
index][tags index] for more information. If this option is specified, tags
3838
will become clickable, pointing to the corresponding section in the tags
@@ -48,7 +48,7 @@ The following configuration options are available:
4848
of `mkdocs.yml`. Note, however, that this options is not required – only use
4949
it if you want a tags index page.
5050

51-
[`tags_extra_files`](#+tags.tags_extra_files){ #+tags.tags_extra_files } :material-alert-decagram:{ .mdx-pulse title="Added on July 7, 2022" }
51+
[`tags_extra_files`](#+tags.tags_extra_files){ #+tags.tags_extra_files }
5252

5353
: [:octicons-tag-24: insiders-4.20.0][Insiders] · :octicons-milestone-24:
5454
Default: _none_ – This option allows to define additional pages to render

material/assets/stylesheets/main.80dcb947.min.css renamed to material/assets/stylesheets/main.20d9efc8.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/stylesheets/main.80dcb947.min.css.map renamed to material/assets/stylesheets/main.20d9efc8.min.css.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{% endif %}
3535
{% endblock %}
3636
{% block styles %}
37-
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.80dcb947.min.css' | url }}">
37+
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.20d9efc8.min.css' | url }}">
3838
{% if config.theme.palette %}
3939
{% set palette = config.theme.palette %}
4040
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.cbb835fc.min.css' | url }}">

src/assets/stylesheets/main/extensions/markdown/_admonition.scss

+25-14
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929

3030
/// Admonition flavours
3131
$admonitions: (
32-
note: pencil $clr-blue-a200,
32+
note: pencil-circle $clr-blue-a200,
3333
abstract summary tldr: clipboard-text $clr-light-blue-a400,
3434
info todo: information $clr-cyan-a700,
3535
tip hint important: fire $clr-teal-a700,
36-
success check done: check-bold $clr-green-a700,
36+
success check done: check $clr-green-a700,
3737
question help faq: help-circle $clr-light-green-a700,
3838
warning caution attention: alert $clr-orange-a400,
39-
failure fail missing: close-thick $clr-red-a200,
40-
danger error: lightning-bolt $clr-red-a400,
41-
bug: bug $clr-pink-a400,
42-
example: format-list-numbered $clr-deep-purple-a200,
39+
failure fail missing: close $clr-red-a200,
40+
danger error: lightning-bolt-circle $clr-red-a400,
41+
bug: shield-bug $clr-pink-a400,
42+
example: test-tube $clr-deep-purple-a200,
4343
quote cite: format-quote-close $clr-grey
4444
) !default;
4545

@@ -62,17 +62,17 @@ $admonitions: (
6262

6363
// Admonition - note that all styles also apply to details tags, which are
6464
// rendered as collapsible admonitions with summary elements as titles.
65-
:is(.admonition, details) {
65+
.admonition,
66+
details {
6667
display: flow-root;
6768
margin: px2em(20px, 12.8px) 0;
6869
padding: 0 px2rem(12px);
6970
color: var(--md-admonition-fg-color);
7071
font-size: px2rem(12.8px);
7172
page-break-inside: avoid;
7273
background-color: var(--md-admonition-bg-color);
73-
border: 0 solid $clr-blue-a200;
74-
border-inline-start-width: px2rem(4px);
75-
border-radius: px2rem(2px);
74+
border: px2rem(1px) solid $clr-blue-a200;
75+
border-radius: px2rem(4px);
7676
box-shadow: var(--md-shadow-z1);
7777

7878
// [print]: Omit shadow as it may lead to rendering errors
@@ -114,12 +114,13 @@ $admonitions: (
114114
}
115115

116116
// Admonition title
117-
:is(.admonition-title, summary) {
117+
.admonition-title,
118+
summary {
118119
position: relative;
119120
margin-block: 0;
120-
margin-inline: px2rem(-16px) px2rem(-12px);
121+
margin-inline: px2rem(-12px);
121122
padding-block: px2rem(8px);
122-
padding-inline: px2rem(44px) px2rem(12px);
123+
padding-inline: px2rem(40px) px2rem(12px);
123124
font-weight: 700;
124125
background-color: color.adjust($clr-blue-a200, $alpha: -0.9);
125126
border: none;
@@ -136,7 +137,7 @@ $admonitions: (
136137
&::before {
137138
position: absolute;
138139
top: px2em(10px);
139-
inset-inline-start: px2rem(16px);
140+
inset-inline-start: px2rem(12px);
140141
width: px2rem(20px);
141142
height: px2rem(20px);
142143
background-color: $clr-blue-a200;
@@ -146,6 +147,11 @@ $admonitions: (
146147
mask-size: contain;
147148
content: "";
148149
}
150+
151+
// Inline code block
152+
code {
153+
box-shadow: 0 0 0 px2rem(1px) var(--md-default-fg-color--lightest);
154+
}
149155
}
150156
}
151157

@@ -178,5 +184,10 @@ $admonitions: (
178184
background-color: $tint;
179185
mask-image: var(--md-admonition-icon--#{$name});
180186
}
187+
188+
// Details marker
189+
&::after {
190+
color: $tint;
191+
}
181192
}
182193
}

0 commit comments

Comments
 (0)