Skip to main content

GitHub Admonitions for MkDocs

Convert GitHub admonitions to mkdocs admonitions when building docs, so that you can have admonitions on GitHub and in the documentation from the same file.

Now also supporting GitLab admonitions (alerts, thanks @pismy!).

[!TIP] This is an admonition. They are a useful tool to attract attention to information.

Usage

To install the plugin:

python -m pip install mkdocs-github-admonitions-plugin

Then in your mkdocs.yml file, add the plugin:

plugins:
  - gh-admonitions

Now you can write GitHub-compatible admonitions, and they will be automatically converted when used in mkdocs pages.

Why is this needed?

Both GitHub and mkdocs support admonitions from their markdown flavors. Unfortunately, their flavors are different. A GitHub admonition is written like this:

> [!TIP]
> This is the GitHub admonition syntax.

And mkdocs admonitions are written like this:

!!! tip

    This is the mkdocs-materials admonition syntax.

So an admonition in your documentation will render correctly on either GitHub or in your mkdocs pages, but not both. With this plugin, you write the admonition once in GitHub syntax, and it will still show correctly in the built mkdocs pages!

Limitations

The mkdocs admonitions are much more powerful. They can feature titles. They have more types, and you can add custom ones. You can render inline admonitions. They can be collapsable, and be collapsed by default. And much more.

But since the GitHub syntax has none of that, this tool can not offer such mkdocs admonitions to be generated. All admonitions will be converted to non-collapsed title-less admonitions.

GitHub admonitions feature two types which are not supported by mkdocs: caution and important. In converting these admonitions, we will preserve their title, but use the danger and warning symbol and color, respectively.

Examples

Here is a gallery with various admonitions. They should show up correctly on the built documentation too!

[!tip] This is normally formatted. Type in lower case. No extra spaces. It contains two lines in markdown, but only a soft linebreak.

[!CAUTION]
This admonition has:

  • ALL CAPS in the type
  • a list

Note that this admonition uses the "danger" symbol with "Caution" title.

[!Important] This contains inline and

import this  # python code in ticks
and code block with spaces

Note that this admonition uses the "warning" symbol with "Important" title.

[!note] And this admonition contains an empty line

That only has a > character in markdown.

[!warning] Admonitions may contains quotes

Quotes always contain great wisdom.

But pay attention! There may be admonitions which are really just code:

> [!note]
> This is not an admonition.

Disclaimer

This is an independent project and not affiliated with GitHub in any way.

Metadata

Release files for mkdocs-github-admonitions-plugin 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdocs-github-admonitions-plugin 0.1.1
File Size Uploaded Provenance Actions
mkdocs_github_admonitions_plugin-0.1.1.tar.gz 5.2 kB Without provenance Details for mkdocs_github_admonitions_plugin-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-github-admonitions-plugin 0.1.1
File Interpreter ABI Platform Actions
mkdocs_github_admonitions_plugin-0.1.1-py3-none-any.whl Python 3 none any Details for mkdocs_github_admonitions_plugin-0.1.1-py3-none-any.whl

Total release size: 10.6 kB

Release files / mkdocs_github_admonitions_plugin-0.1.1.tar.gz

Download URL mkdocs_github_admonitions_plugin-0.1.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7f81520a0681b9955952d73b21ce99b923921830b6b6d1ace9b3fb95cd1fb61f
BLAKE2b-256 checksum
How to use checksums
126237f2080af26ec1d569bb21eb2a4d54f5ea54d36a92938abbbc37c6ab671b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release files / mkdocs_github_admonitions_plugin-0.1.1-py3-none-any.whl

Download URL mkdocs_github_admonitions_plugin-0.1.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
824dc821764171943c1043c88218d4af0329693870ba9be657f890d484a0aa85
BLAKE2b-256 checksum
How to use checksums
e8a38cfd5d9a651612b0d2a15176341b040d43d27b063e17684cb353ec7ce789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Security for mkdocs-github-admonitions-plugin 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page