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, any of the internal plugins can be imported as needed.

from markdown_it import MarkdownIt
from mdformat_admon.plugins import python_markdown_admon_plugin

md = MarkdownIt("commonmark")
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 the example 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.0.tar.gz (11.5 kB view hashes)

Uploaded Source

Built Distribution

mdformat_admon-2.0.0-py3-none-any.whl (8.8 kB view hashes)

Uploaded Python 3

Supported by

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