@@ -404,37 +404,9 @@ the default type, and thus fallback for unknown type qualifiers, is `note`:
404
404
405
405
# ## Custom admonitions
406
406
407
- [:octicons-file-code-24 : Source][Source] ·
408
- :octicons-mortar-board-24 : Difficulty: _easy_
409
-
410
407
If you want to add a custom admonition type, all you need is a color and an
411
- ` *.svg` icon. Copy the icon's code from the [`.icons`][Custom icons] folder
412
- and add the following CSS to an [additional stylesheet] :
413
-
414
- ` ` ` css
415
- :root {
416
- --md-admonition-icon--pied-piper: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M244 246c-3.2-2-6.3-2.9-10.1-2.9-6.6 0-12.6 3.2-19.3 3.7l1.7 4.9zm135.9 197.9c-19 0-64.1 9.5-79.9 19.8l6.9 45.1c35.7 6.1 70.1 3.6 106-9.8-4.8-10-23.5-55.1-33-55.1zM340.8 177c6.6 2.8 11.5 9.2 22.7 22.1 2-1.4 7.5-5.2 7.5-8.6 0-4.9-11.8-13.2-13.2-23 11.2-5.7 25.2-6 37.6-8.9 68.1-16.4 116.3-52.9 146.8-116.7C548.3 29.3 554 16.1 554.6 2l-2 2.6c-28.4 50-33 63.2-81.3 100-31.9 24.4-69.2 40.2-106.6 54.6l-6.3-.3v-21.8c-19.6 1.6-19.7-14.6-31.6-23-18.7 20.6-31.6 40.8-58.9 51.1-12.7 4.8-19.6 10-25.9 21.8 34.9-16.4 91.2-13.5 98.8-10zM555.5 0l-.6 1.1-.3.9.6-.6zm-59.2 382.1c-33.9-56.9-75.3-118.4-150-115.5l-.3-6c-1.1-13.5 32.8 3.2 35.1-31l-14.4 7.2c-19.8-45.7-8.6-54.3-65.5-54.3-14.7 0-26.7 1.7-41.4 4.6 2.9 18.6 2.2 36.7-10.9 50.3l19.5 5.5c-1.7 3.2-2.9 6.3-2.9 9.8 0 21 42.8 2.9 42.8 33.6 0 18.4-36.8 60.1-54.9 60.1-8 0-53.7-50-53.4-60.1l.3-4.6 52.3-11.5c13-2.6 12.3-22.7-2.9-22.7-3.7 0-43.1 9.2-49.4 10.6-2-5.2-7.5-14.1-13.8-14.1-3.2 0-6.3 3.2-9.5 4-9.2 2.6-31 2.9-21.5 20.1L15.9 298.5c-5.5 1.1-8.9 6.3-8.9 11.8 0 6 5.5 10.9 11.5 10.9 8 0 131.3-28.4 147.4-32.2 2.6 3.2 4.6 6.3 7.8 8.6 20.1 14.4 59.8 85.9 76.4 85.9 24.1 0 58-22.4 71.3-41.9 3.2-4.3 6.9-7.5 12.4-6.9.6 13.8-31.6 34.2-33 43.7-1.4 10.2-1 35.2-.3 41.1 26.7 8.1 52-3.6 77.9-2.9 4.3-21 10.6-41.9 9.8-63.5l-.3-9.5c-1.4-34.2-10.9-38.5-34.8-58.6-1.1-1.1-2.6-2.6-3.7-4 2.2-1.4 1.1-1 4.6-1.7 88.5 0 56.3 183.6 111.5 229.9 33.1-15 72.5-27.9 103.5-47.2-29-25.6-52.6-45.7-72.7-79.9zm-196.2 46.1v27.2l11.8-3.4-2.9-23.8zm-68.7-150.4l24.1 61.2 21-13.8-31.3-50.9zm84.4 154.9l2 12.4c9-1.5 58.4-6.6 58.4-14.1 0-1.4-.6-3.2-.9-4.6-26.8 0-36.9 3.8-59.5 6.3z"/></svg>')
417
- }
418
- .md-typeset .admonition.pied-piper,
419
- .md-typeset details.pied-piper {
420
- border-color: rgb(43, 155, 70);
421
- }
422
- .md-typeset .pied-piper > .admonition-title,
423
- .md-typeset .pied-piper > summary {
424
- background-color: rgba(43, 155, 70, 0.1);
425
- border-color: rgb(43, 155, 70);
426
- }
427
- .md-typeset .pied-piper > .admonition-title::before,
428
- .md-typeset .pied-piper > summary::before {
429
- background-color: rgb(43, 155, 70);
430
- -webkit-mask-image: var(--md-admonition-icon--pied-piper);
431
- mask-image: var(--md-admonition-icon--pied-piper);
432
- }
433
- ` ` `
434
-
435
- You should now be able to create an admonition of the `pied-piper` type. Note
436
- that you can also use this technique to override existing admonition icons or
437
- colors. [You can even add animations][Custom animations].
408
+ ` *.svg` icon. Copy the icon's code from the [`.icons`][custom icons] folder
409
+ and add the following CSS to an [additional style sheet] :
438
410
439
411
<style>
440
412
:root {
@@ -459,13 +431,45 @@ colors. [You can even add animations][Custom animations].
459
431
460
432
_Example_ :
461
433
462
- ` ` ` markdown
463
- !!! pied-piper "Pied Piper"
434
+ === ":octicons-file-code-16 : docs/example.md"
464
435
465
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
466
- nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
467
- massa, nec semper lorem quam in massa.
468
- ` ` `
436
+ ` ` ` markdown
437
+ !!! pied-piper "Pied Piper"
438
+
439
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et
440
+ euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo
441
+ purus auctor massa, nec semper lorem quam in massa.
442
+ ` ` `
443
+
444
+ === ":octicons-file-code-16 : docs/stylesheets/admonitions.css"
445
+
446
+ ` ` ` css
447
+ :root {
448
+ --md-admonition-icon--pied-piper: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M244 246c-3.2-2-6.3-2.9-10.1-2.9-6.6 0-12.6 3.2-19.3 3.7l1.7 4.9zm135.9 197.9c-19 0-64.1 9.5-79.9 19.8l6.9 45.1c35.7 6.1 70.1 3.6 106-9.8-4.8-10-23.5-55.1-33-55.1zM340.8 177c6.6 2.8 11.5 9.2 22.7 22.1 2-1.4 7.5-5.2 7.5-8.6 0-4.9-11.8-13.2-13.2-23 11.2-5.7 25.2-6 37.6-8.9 68.1-16.4 116.3-52.9 146.8-116.7C548.3 29.3 554 16.1 554.6 2l-2 2.6c-28.4 50-33 63.2-81.3 100-31.9 24.4-69.2 40.2-106.6 54.6l-6.3-.3v-21.8c-19.6 1.6-19.7-14.6-31.6-23-18.7 20.6-31.6 40.8-58.9 51.1-12.7 4.8-19.6 10-25.9 21.8 34.9-16.4 91.2-13.5 98.8-10zM555.5 0l-.6 1.1-.3.9.6-.6zm-59.2 382.1c-33.9-56.9-75.3-118.4-150-115.5l-.3-6c-1.1-13.5 32.8 3.2 35.1-31l-14.4 7.2c-19.8-45.7-8.6-54.3-65.5-54.3-14.7 0-26.7 1.7-41.4 4.6 2.9 18.6 2.2 36.7-10.9 50.3l19.5 5.5c-1.7 3.2-2.9 6.3-2.9 9.8 0 21 42.8 2.9 42.8 33.6 0 18.4-36.8 60.1-54.9 60.1-8 0-53.7-50-53.4-60.1l.3-4.6 52.3-11.5c13-2.6 12.3-22.7-2.9-22.7-3.7 0-43.1 9.2-49.4 10.6-2-5.2-7.5-14.1-13.8-14.1-3.2 0-6.3 3.2-9.5 4-9.2 2.6-31 2.9-21.5 20.1L15.9 298.5c-5.5 1.1-8.9 6.3-8.9 11.8 0 6 5.5 10.9 11.5 10.9 8 0 131.3-28.4 147.4-32.2 2.6 3.2 4.6 6.3 7.8 8.6 20.1 14.4 59.8 85.9 76.4 85.9 24.1 0 58-22.4 71.3-41.9 3.2-4.3 6.9-7.5 12.4-6.9.6 13.8-31.6 34.2-33 43.7-1.4 10.2-1 35.2-.3 41.1 26.7 8.1 52-3.6 77.9-2.9 4.3-21 10.6-41.9 9.8-63.5l-.3-9.5c-1.4-34.2-10.9-38.5-34.8-58.6-1.1-1.1-2.6-2.6-3.7-4 2.2-1.4 1.1-1 4.6-1.7 88.5 0 56.3 183.6 111.5 229.9 33.1-15 72.5-27.9 103.5-47.2-29-25.6-52.6-45.7-72.7-79.9zm-196.2 46.1v27.2l11.8-3.4-2.9-23.8zm-68.7-150.4l24.1 61.2 21-13.8-31.3-50.9zm84.4 154.9l2 12.4c9-1.5 58.4-6.6 58.4-14.1 0-1.4-.6-3.2-.9-4.6-26.8 0-36.9 3.8-59.5 6.3z"/></svg>')
449
+ }
450
+ .md-typeset .admonition.pied-piper,
451
+ .md-typeset details.pied-piper {
452
+ border-color: rgb(43, 155, 70);
453
+ }
454
+ .md-typeset .pied-piper > .admonition-title,
455
+ .md-typeset .pied-piper > summary {
456
+ background-color: rgba(43, 155, 70, 0.1);
457
+ border-color: rgb(43, 155, 70);
458
+ }
459
+ .md-typeset .pied-piper > .admonition-title::before,
460
+ .md-typeset .pied-piper > summary::before {
461
+ background-color: rgb(43, 155, 70);
462
+ -webkit-mask-image: var(--md-admonition-icon--pied-piper);
463
+ mask-image: var(--md-admonition-icon--pied-piper);
464
+ }
465
+ ` ` `
466
+
467
+ === ":octicons-file-code-16 : mkdocs.yml"
468
+
469
+ ` ` ` yaml
470
+ extra_css:
471
+ - stylesheets/admonitions.css
472
+ ` ` `
469
473
470
474
_Result_ :
471
475
@@ -475,7 +479,5 @@ _Result_:
475
479
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
476
480
massa, nec semper lorem quam in massa.
477
481
478
- [Source] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/extensions/markdown/_admonition.scss
479
- [Custom icons] : https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
480
- [Custom animations] : icons-emojis.md#with-animations
481
- [additional stylesheet] : ../customization.md#additional-css
482
+ [custom icons] : https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
483
+ [additional style sheet] : ../customization.md#additional-css
0 commit comments