Notes, infos, warnings and dangers

The Admonition extension adds rST-style admonitions to Markdown documents.

Configuration

# mkdocs.yml

markdown_extensions:
  - admonition

Syntax

!!! info "Information:"
    Something **new** is coming to `mkdocs-shadcn`

!!! note "Note:"
    We notice that `x=2`

!!! warning "Warning:"
    There is a *risk* doing `x/0`

!!! danger "Danger:"
    Don't look at `node_modules` **please**!

Information:

Something new is coming to mkdocs-shadcn

Note:

We notice that x=2

Warning:

There is a risk doing x/0

Danger:

Don't look at node_modules please!

Code

You cannot use fenced_code inside admonition since:

Fenced Code Blocks are only supported at the document root level (source)

Currently, only codehilite can be nested inside admonition, like in the example below.

!!! note "Admonition + Code"
    You may face the limits of `codehilite` however.

        :::python
        def fibonacci(n):
            a, b = 0, 1
            for _ in range(n):
                yield a
                a, b = b, a + b

        for num in fibonacci(10):
            print(num)

Admonition + Code

You may face the limits of codehilite however.

def fibonacci(n):
    a, b = 0, 1
    for _ in range(n):
        yield a
        a, b = b, a + b

for num in fibonacci(10):
    print(num)