Skip to main content

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

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markdown-alerts-0.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markdown_alerts-0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file markdown-alerts-0.1.tar.gz.

File metadata

  • Download URL: markdown-alerts-0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for markdown-alerts-0.1.tar.gz
Algorithm Hash digest
SHA256 a5dd1eab56c84043ce9d0f52eb8b36fda8a65362211c38ff565f9beb992c08f8
MD5 3e576ae3ad96f267997452463769537b
BLAKE2b-256 69a59e957ddf8a697d2c7a4fb6c83102e3edc9eaf3bb5d91fe40652a99fa7f7a

See more details on using hashes here.

File details

Details for the file markdown_alerts-0.1-py3-none-any.whl.

File metadata

  • Download URL: markdown_alerts-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for markdown_alerts-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9e6fbc8b23c3148ed0d97b747c60f03e99a4c474bae2a56244a081a82c5933c2
MD5 ec95d08ac25f1070f0105b1050fa4c21
BLAKE2b-256 997c3a2ff9d3b66c0977f0ed95ce418ef527cd88a9956ec95de6b85d418bac22

See more details on using hashes here.

Supported by

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