Skip to main content

Extension for python-markdown that adds markdown syntax for badges.

Project description

Badge

Summary

The markdown-badge extension adds support for badges to Markdown documents. Badges are otherwise known as Labels or Tags, and the UI used to create them is often described as a Chip or a Pill.

Syntax

Badges are created using the following syntax:

{{ type "optional explicit title within double quotes" }}

type will be used as the CSS class name and as default title. It must be a single word. So, for instance:

{{ note "Alpha" }}

will render:

<span class="badge note">
<span class="badge-title">Alpha</span>
</span>

Optionally, you can use custom titles. For instance:

{{ danger "Warning" }}

will render:

<span class="badge danger">
<span class="badge-title">Warning</span>
</span>

If you don't want a title, use a blank string "":

This is a badge without a title: {{ important "" }}

results in:

<span class="badge danger"></span>

You can also provide additional CSS class names separated by spaces. The first class should be the "type." For example:

{{ danger highlight blink "Don't try this at home" }}

will render:

<span class="badge danger highlight blink">
<span class="badge-title">Don't try this at home</span>
</span>

Styling

There is no CSS included as part of this extension. Check out the default Sphinx theme for inspiration.

Usage

See Extensions for general extension usage. Use badge as the name of the extension.

This extension does not accept any special configuration options.

A trivial example:

markdown.markdown(some_text, extensions=['badge'])

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

markdown-badge-1.0.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

markdown_badge-1.0.3-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file markdown-badge-1.0.3.tar.gz.

File metadata

  • Download URL: markdown-badge-1.0.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for markdown-badge-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d18ddf6f17fd94b62ce34a3fff5b3cfdac809624c8b3009e578aeab50836b7ef
MD5 4484307dcdb4cef69d7c1fc98293c139
BLAKE2b-256 73e954cb4b0dcd9fafd8004b3ee46fe6af6afbf9982e0fda07091b9f203f9292

See more details on using hashes here.

File details

Details for the file markdown_badge-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: markdown_badge-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for markdown_badge-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b001485c776fa8d6b4f16b94760026198ec067728acc817e9fc3ffd039043472
MD5 279657a1818408c2fd10902eb146525f
BLAKE2b-256 6c95c30f7b71f1f4cece7cf0f37dbaadc6a8913c50647c7b671d509320baeca2

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