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.6.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

mdformat_admon-2.0.6-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mdformat_admon-2.0.6.tar.gz
Algorithm Hash digest
SHA256 009aa1c5e171cf03ee65588579e7f5310929a67712127020a0369a645339f0e8
MD5 acb4b487ec09beaff3a873fe00935f29
BLAKE2b-256 f17f4e3aa626b04a16e466cabb0143b644ba13677182c0f37e3afed4e569e28a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mdformat_admon-2.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2fda60659d11210d6cb07ee0df11bf68bae84f75bbd471de8b786accdb674ede
MD5 0feb4886b3c64a76a77fae603227edd5
BLAKE2b-256 0d4524d1799a7eedcfa4e26b4b8503694618420195f35448e591f2687e0d062b

See more details on using hashes here.

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