Skip to main content

An mdformat plugin for `admonition`.

Project description

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

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

pipx/uv

pipx install mdformat
pipx inject mdformat mdformat-admon

Or with uv:

uv tool run --from mdformat-admon mdformat

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdformat_admon-2.1.1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdformat_admon-2.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file mdformat_admon-2.1.1.tar.gz.

File metadata

  • Download URL: mdformat_admon-2.1.1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for mdformat_admon-2.1.1.tar.gz
Algorithm Hash digest
SHA256 605df53bec06eba63f0ad510f7f67cdead9c328ec807bca1db76026a66a68d9e
MD5 e662320d9a3849759a532d3316d01deb
BLAKE2b-256 cb425188f91e20ef1c563b4feb687f300c9ff4d16b4105dd94aab61bda8e3cef

See more details on using hashes here.

File details

Details for the file mdformat_admon-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mdformat_admon-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2efae84da6d4eaa453a7cf0eca7437dc1c1e347a0780abfa5eecfdda03630c2
MD5 860031a5583c7b23a1dd72ca4d3e8607
BLAKE2b-256 9e0d1d9a3a59295ce2236bec57a90a32a81bb268aad03e1daa3b40db7e9f44a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page