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.2.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

markdown_badge-1.0.2-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

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