Python-Markdown Admonition alternative.
Project description
markdown-alerts
Python-Markdown Admonition alternative extension with a shortened syntax. Depends Python-Markdown.
This extension supports one-line and multi-line text. The end of the remark block is an empty line.
Example:
:::info This is an one-line admonition!
:::info This is a
multi-line
admonition!
:::info
It works too!
This paragraph is not an admonition's part.
There can be an arbitrary number of spaces between the admonition start character :::
and the admonition type designation.
Supported admonition types:
:::info
:::note
:::tip
:::success
:::warning
:::danger
Installation and usage
Installation:
pip install markdown-alerts
Usage:
from markdown import Markdown
html = Markdown(extensions=['markdown_alerts'])
Configuration
By default, the extension installs the following CSS classes for div blocks. For example for :::note
:
<div class="alert note">
<p>This is note!</p>
</div>
You can override these classes by adding your own configuration. Example for Bootstrap 5:
ext_configs = {
'markdown_alerts': {
'info': 'alert alert-info',
'note': 'alert alert-primary',
'tip': 'alert alert-success',
'success': 'alert alert-success',
'warning': 'alert alert-warning',
'danger': 'alert alert-danger'
}
}
html = Markdown(
extensions=['markdown_alerts'],
extension_configs=ext_configs
)
License
This software is provided under The Unlicense. See LICENSE for details.
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 markdown_alerts-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e6fbc8b23c3148ed0d97b747c60f03e99a4c474bae2a56244a081a82c5933c2 |
|
MD5 | ec95d08ac25f1070f0105b1050fa4c21 |
|
BLAKE2b-256 | 997c3a2ff9d3b66c0977f0ed95ce418ef527cd88a9956ec95de6b85d418bac22 |