An mdformat plugin for admonitions
, a set of helpers for supporting new admonition syntaxes, and tool for rendering admonition HTML.
Add this package wherever you use mdformat
and the plugin will be auto-recognized. No additional configuration necessary. See additional information on mdformat
plugins here
repos:
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
additional_dependencies:
- mdformat-admon
pipx install mdformat
pipx inject mdformat mdformat-admon
To generate HTML output, python_markdown_admon_plugin
can be imported from mdit_plugins
. More plugins will be added in the future. For more guidance on MarkdownIt
, see the docs: https://markdown-it-py.readthedocs.io/en/latest/using.html#the-parser
from markdown_it import MarkdownIt
from mdformat_admon.mdit_plugins import python_markdown_admon_plugin
md = MarkdownIt()
md.use(python_markdown_admon_plugin)
text = '!!! note ""\n *content*'
md.render(text)
# <div class="admonition note">
# <p><em>content</em></p>
# </div>
Because admonition syntax varies wildly between implementations, this package provides a set of helpers for building new admonition parsers under mdformat_admon.factories
.
- Supported by
mdformat-admon
- Supported by other packages
- Currently Unsupported (or at least not known to be supported)
- Variations of Directives:
- Mozilla Callouts
See how different admonition formats are handled in this test file: ./tests/pre-commit-test.md
See CONTRIBUTING.md