An mdformat plugin for admonitions.
Project description
mdformat-admon
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
.
- Supported by
mdformat-admon
- Supported by other packages
- Currently Unsupported (or at least not known to be supported)
- Github
- MyST
- Remark-Admonitions
- pymdown-extensions
- reStructuredText (Note: this plugin may break these admonitions by removing or modifying indentation)
- Obsidian Callouts (Note: this plugin may break these admonitions by adding extra characters)
See the example test file: ./tests/pre-commit-test.md
Contributing
See CONTRIBUTING.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mdformat_admon-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7be9db19b9e0a752756c9f3a58ed3119fa15897df9951353e4df018e8fa0b7ae |
|
MD5 | cbbfea4f77eb45501ad5a0bba4be2174 |
|
BLAKE2b-256 | 466eed26aef6858642332ce6577e31f47d1ba933e6059313ad58ac86201e72e8 |