markdown-gfm-admonition

November 25, 2025 ยท View on GitHub

PyPI GitHub Actions status

This package is an extension of Python Markdown that enables the admonition syntax of GitHub Flavored Markdown.

There are five types of admonitions:

> [!NOTE]
> Highlights information that users should take into account,
> even when skimming.

> [!TIP]
> Optional information to help a user be more successful.

> [!IMPORTANT]
> Crucial information necessary for users to succeed.

> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.

> [!CAUTION]
> Negative potential consequences of an action.

It generates the same HTML as Python Markdown's built-in admonition extension:

<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Highlights information that users should take into account,
even when skimming.</p>
</div>

Usage

To use this extension, you need to install it first:

uv add markdown-gfm-admonition
# or
pip install markdown-gfm-admonition

Then, you can use it in your Python code like this:

from markdown import Markdown
from markdown_gfm_admonition import GfmAdmonitionExtension

md = Markdown(extensions=[GfmAdmonitionExtension()])
html = md.convert("""
> [!NOTE]
> Highlights information that users should take into account,
> even when skimming.
""")

Tip

Instead of importing GfmAdmonitionExtension directly, you can use the entry point "gfm_admonition" as well to load the extension:

md = Markdown(extensions=["gfm_admonition"])