Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Repository files navigation

mdformat-admon

Build Status PyPI version

An mdformat plugin for formatting python-markdown admonitions and rendering the associated HTML.

Warning

mdformat-admon and mdformat-mkdocs>=4.0.0 are no longer compatible. If you have both, you'll want to remove mdformat-admon

The stylistic formatting for mkdocs differs from Python Markdown (#22), so this package is now only for Python Markdown without mkdocs.

mdformat Usage

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

pre-commit / prek

repos:
  - repo: https://github.com/executablebooks/mdformat
    rev: 0.7.19
    hooks:
      - id: mdformat
        additional_dependencies:
          - mdformat-admon

uvx

uvx --with mdformat-admon mdformat

Or with pipx:

pipx install mdformat
pipx inject mdformat mdformat-admon

HTML Rendering

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>

Contributing

See CONTRIBUTING.md

About

An mdformat plugin for "python-markdown" admonitions

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.