Skip to main content

An mdformat plugin for admonitions.

Project description

mdformat-admon

Build Status PyPI version

An mdformat plugin for admonitions, a set of helpers for supporting new admonition syntaxes, and tool for rendering admonition HTML.

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.16
    hooks:
      - id: mdformat
        additional_dependencies:
          - mdformat-admon

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>

Extensibility

Because admonition syntax varies wildly between implementations, this package provides a set of helpers for building new admonition parsers under mdformat_admon.factories.

See how different admonition formats are handled in this test file: ./tests/pre-commit-test.md

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.0.2.tar.gz (12.2 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.0.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mdformat_admon-2.0.2.tar.gz
Algorithm Hash digest
SHA256 66bf6debb4f904ff4549b5bc59380a92add16c16fb51b220f3f7288157702fea
MD5 0c86011a861e9b32fc3f0f21218ece9d
BLAKE2b-256 31bc7cc59c6c5d615e99a3d9da9c5fa32e40f4123f44d404a36f3c8a5d16346c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mdformat_admon-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fb99e5c1ed63207712abd8edd7af880227d972dbbc5a5266ae0ff205dec3210f
MD5 24f8906f2d16f8aa10df0ba30987790d
BLAKE2b-256 5ceb6fd18c7435a6a9a740237d6eecd49c4e2d7b4d13e8dc937f5a49045a6e28

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