https://github.com/dahlia/markdown-gfm-admonition
An extension of Python Markdown that enables the admonition syntax of GFM
https://github.com/dahlia/markdown-gfm-admonition
admonition gfm python-markdown
Last synced: 5 months ago
JSON representation
An extension of Python Markdown that enables the admonition syntax of GFM
- Host: GitHub
- URL: https://github.com/dahlia/markdown-gfm-admonition
- Owner: dahlia
- License: lgpl-3.0
- Created: 2023-11-19T06:04:49.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-04T12:58:06.000Z (5 months ago)
- Last Synced: 2025-05-04T13:42:03.940Z (5 months ago)
- Topics: admonition, gfm, python-markdown
- Language: Python
- Homepage: https://pypi.org/project/markdown-gfm-admonition/
- Size: 12.7 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
markdown-gfm-admonition
=======================[![PyPI][PyPI badge]][PyPI]
[![GitHub Actions status][GitHub Actions status badge]][GitHub Actions status]This package is an extension of [Python Markdown] that enables
the [admonition syntax of GitHub Flavored Markdown][1].There are five types of admonitions:
~~~~ markdown
> [!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][2]:~~~~ html
Note
Highlights information that users should take into account,
even when skimming.
~~~~[PyPI badge]: https://img.shields.io/pypi/v/markdown-gfm-admonition
[PyPI]: https://pypi.org/project/markdown-gfm-admonition/
[GitHub Actions status badge]: https://github.com/dahlia/markdown-gfm-admonition/actions/workflows/build.yaml/badge.svg
[GitHub Actions status]: https://github.com/dahlia/markdown-gfm-admonition/actions/workflows/build.yaml
[Python Markdown]: https://github.com/Python-Markdown/markdown
[1]: https://github.com/orgs/community/discussions/16925
[2]: https://python-markdown.github.io/extensions/admonition/Usage
-----To use this extension, you need to install it first:
~~~~ bash
pip install markdown-gfm-admonition
~~~~Then, you can use it in your Python code like this:
~~~~ python
from markdown import Markdown
from markdown_gfm_admonition import GfmAdmonitionExtensionmd = 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:
>
> ~~~~ python
> md = Markdown(extensions=["gfm_admonition"])
> ~~~~