# mdformat-admon
[![Build Status][ci-badge]][ci-link] [![PyPI version][pypi-badge]][pypi-link]
<!-- [![codecov.io][cov-badge]][cov-link]
[cov-badge]: https://codecov.io/gh/executablebooks/mdformat-admon/branch/main/graph/badge.svg
[cov-link]: https://codecov.io/gh/executablebooks/mdformat-admon
-->
An [mdformat](https://github.com/executablebooks/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](https://mdformat.readthedocs.io/en/stable/users/plugins.html)
### Pre-Commit
```yaml
repos:
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
additional_dependencies:
- mdformat-admon
```
### pipx
```sh
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>
```py
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`.
- Supported by `mdformat-admon`
- [python-markdown](https://python-markdown.github.io/extensions/admonition)
- Supported by other packages
- [`mdformat-mkdocs`](https://github.com/KyleKing/mdformat-mkdocs)
- [MKDocs Admonitions](https://squidfunk.github.io/mkdocs-material/reference/admonitions)
- [`mdformat-gfm-alerts`](https://github.com/KyleKing/mdformat-gfm-alerts)
- [Github "Alerts"](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) and [MicroSoft "Alerts"](https://learn.microsoft.com/en-us/contribute/content/markdown-reference#alerts-note-tip-important-caution-warning)
- [`mdformat-obsidian`](https://github.com/KyleKing/mdformat-obsidian)
- [Obsidian Callouts](https://help.obsidian.md/How+to/Use+callouts)
- Currently Unsupported (or at least not known to be supported)
- Variations of Directives:
- [node.js markdown-it-container](https://github.com/markdown-it/markdown-it-container)
- [MyST](https://myst-parser.readthedocs.io/en/latest/syntax/roles-and-directives.html)
- [Sphinx Directives](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html)
- [reStructuredText](https://docutils.sourceforge.io/docs/ref/rst/directives.html#specific-admonitions)
- [pymdown-extensions](https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/admonition)
- [PyMDown](https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/admonition)
- [Mozilla Callouts](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Howto/Markdown_in_MDN#notes_warnings_and_callouts)
See how different admonition formats are handled in this test file: [./tests/pre-commit-test.md](https://raw.githubusercontent.com/KyleKing/mdformat-admon/main/tests/pre-commit-test.md)
## Contributing
See [CONTRIBUTING.md](https://github.com/KyleKing/mdformat-admon/blob/main/CONTRIBUTING.md)
[ci-badge]: https://github.com/kyleking/mdformat-admon/workflows/CI/badge.svg?branch=main
[ci-link]: https://github.com/kyleking/mdformat-admon/actions?query=workflow%3ACI+branch%3Amain+event%3Apush
[pypi-badge]: https://img.shields.io/pypi/v/mdformat-admon.svg
[pypi-link]: https://pypi.org/project/mdformat-admon
Raw data
{
"_id": null,
"home_page": null,
"name": "mdformat_admon",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8.5",
"maintainer_email": null,
"keywords": "markdown, markdown-it, mdformat, mdformat_plugin_template",
"author": null,
"author_email": "kyleking <dev.act.kyle@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f1/7f/4e3aa626b04a16e466cabb0143b644ba13677182c0f37e3afed4e569e28a/mdformat_admon-2.0.6.tar.gz",
"platform": null,
"description": "# mdformat-admon\n\n[![Build Status][ci-badge]][ci-link] [![PyPI version][pypi-badge]][pypi-link]\n\n<!-- [![codecov.io][cov-badge]][cov-link]\n[cov-badge]: https://codecov.io/gh/executablebooks/mdformat-admon/branch/main/graph/badge.svg\n[cov-link]: https://codecov.io/gh/executablebooks/mdformat-admon\n -->\n\nAn [mdformat](https://github.com/executablebooks/mdformat) plugin for `admonitions`, a set of helpers for supporting new admonition syntaxes, and tool for rendering admonition HTML.\n\n## `mdformat` Usage\n\nAdd this package wherever you use `mdformat` and the plugin will be auto-recognized. No additional configuration necessary. See [additional information on `mdformat` plugins here](https://mdformat.readthedocs.io/en/stable/users/plugins.html)\n\n### Pre-Commit\n\n```yaml\nrepos:\n - repo: https://github.com/executablebooks/mdformat\n rev: 0.7.16\n hooks:\n - id: mdformat\n additional_dependencies:\n - mdformat-admon\n```\n\n### pipx\n\n```sh\npipx install mdformat\npipx inject mdformat mdformat-admon\n```\n\n## HTML Rendering\n\nTo 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>\n\n```py\nfrom markdown_it import MarkdownIt\nfrom mdformat_admon.mdit_plugins import python_markdown_admon_plugin\n\nmd = MarkdownIt()\nmd.use(python_markdown_admon_plugin)\n\ntext = '!!! note \"\"\\n *content*'\nmd.render(text)\n# <div class=\"admonition note\">\n# <p><em>content</em></p>\n# </div>\n```\n\n## Extensibility\n\nBecause admonition syntax varies wildly between implementations, this package provides a set of helpers for building new admonition parsers under `mdformat_admon.factories`.\n\n- Supported by `mdformat-admon`\n - [python-markdown](https://python-markdown.github.io/extensions/admonition)\n- Supported by other packages\n - [`mdformat-mkdocs`](https://github.com/KyleKing/mdformat-mkdocs)\n - [MKDocs Admonitions](https://squidfunk.github.io/mkdocs-material/reference/admonitions)\n - [`mdformat-gfm-alerts`](https://github.com/KyleKing/mdformat-gfm-alerts)\n - [Github \"Alerts\"](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) and [MicroSoft \"Alerts\"](https://learn.microsoft.com/en-us/contribute/content/markdown-reference#alerts-note-tip-important-caution-warning)\n - [`mdformat-obsidian`](https://github.com/KyleKing/mdformat-obsidian)\n - [Obsidian Callouts](https://help.obsidian.md/How+to/Use+callouts)\n- Currently Unsupported (or at least not known to be supported)\n - Variations of Directives:\n - [node.js markdown-it-container](https://github.com/markdown-it/markdown-it-container)\n - [MyST](https://myst-parser.readthedocs.io/en/latest/syntax/roles-and-directives.html)\n - [Sphinx Directives](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html)\n - [reStructuredText](https://docutils.sourceforge.io/docs/ref/rst/directives.html#specific-admonitions)\n - [pymdown-extensions](https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/admonition)\n - [PyMDown](https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/admonition)\n - [Mozilla Callouts](https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Howto/Markdown_in_MDN#notes_warnings_and_callouts)\n\nSee how different admonition formats are handled in this test file: [./tests/pre-commit-test.md](https://raw.githubusercontent.com/KyleKing/mdformat-admon/main/tests/pre-commit-test.md)\n\n## Contributing\n\nSee [CONTRIBUTING.md](https://github.com/KyleKing/mdformat-admon/blob/main/CONTRIBUTING.md)\n\n[ci-badge]: https://github.com/kyleking/mdformat-admon/workflows/CI/badge.svg?branch=main\n[ci-link]: https://github.com/kyleking/mdformat-admon/actions?query=workflow%3ACI+branch%3Amain+event%3Apush\n[pypi-badge]: https://img.shields.io/pypi/v/mdformat-admon.svg\n[pypi-link]: https://pypi.org/project/mdformat-admon\n",
"bugtrack_url": null,
"license": null,
"summary": "An mdformat plugin for admonitions.",
"version": "2.0.6",
"project_urls": {
"Bug Tracker": "https://github.com/kyleking/mdformat-admon/issues",
"Changelog": "https://github.com/kyleking/mdformat-admon/releases",
"homepage": "https://github.com/kyleking/mdformat-admon"
},
"split_keywords": [
"markdown",
" markdown-it",
" mdformat",
" mdformat_plugin_template"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0d4524d1799a7eedcfa4e26b4b8503694618420195f35448e591f2687e0d062b",
"md5": "0feb4886b3c64a76a77fae603227edd5",
"sha256": "2fda60659d11210d6cb07ee0df11bf68bae84f75bbd471de8b786accdb674ede"
},
"downloads": -1,
"filename": "mdformat_admon-2.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0feb4886b3c64a76a77fae603227edd5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.5",
"size": 9608,
"upload_time": "2024-06-24T00:46:42",
"upload_time_iso_8601": "2024-06-24T00:46:42.429630Z",
"url": "https://files.pythonhosted.org/packages/0d/45/24d1799a7eedcfa4e26b4b8503694618420195f35448e591f2687e0d062b/mdformat_admon-2.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f17f4e3aa626b04a16e466cabb0143b644ba13677182c0f37e3afed4e569e28a",
"md5": "acb4b487ec09beaff3a873fe00935f29",
"sha256": "009aa1c5e171cf03ee65588579e7f5310929a67712127020a0369a645339f0e8"
},
"downloads": -1,
"filename": "mdformat_admon-2.0.6.tar.gz",
"has_sig": false,
"md5_digest": "acb4b487ec09beaff3a873fe00935f29",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.5",
"size": 13030,
"upload_time": "2024-06-24T00:46:45",
"upload_time_iso_8601": "2024-06-24T00:46:45.168069Z",
"url": "https://files.pythonhosted.org/packages/f1/7f/4e3aa626b04a16e466cabb0143b644ba13677182c0f37e3afed4e569e28a/mdformat_admon-2.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-24 00:46:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kyleking",
"github_project": "mdformat-admon",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "mdformat_admon"
}