Python-Markdown extension: priority badges from !level inline keywords and ! / !! task-list shorthand
Project description
markdown-priority-badges
A Python-Markdown extension that renders priority badges two ways: !level keywords inline anywhere, and a ! / !! shorthand on task-list items. Works in Zensical, MkDocs, or plain Python-Markdown. The badge ships its own inline styles, so no external CSS is required.
Why?
This is not a replacement for admonitions / callouts (!!! warning, > [!NOTE]). Those wrap a block of explanatory text. Priority badges are the opposite: tiny inline pills you can drop anywhere, but that fit especially nicely into a list item, todo, or table cell, so priority is scannable at a glance without turning the line into a block. The intended usage is exactly that split: reach for a callout when you have a paragraph to say, and reach for a badge to mark some rows.
Inline keywords
Inline !level keywords (!low / !medium / !high / !critical) work anywhere (prose, headings, table cells):
This migration is !critical and blocks the release.
## !high Rotate the keys
Only the configured level keywords match, so an ordinary !, !important, or !highest in text is never touched.
Todo shorthand
Inside a checkbox item, ! = high and !! = critical, a quick shorthand for !high / !critical. The explicit !level keywords (including custom ones like !todo) work in list items too, so a todo list can mix all of them:
- [ ] !blocker Waiting on vendor API access
- [ ] !! Ship the security patch today
- [ ] ! Review the migration PR
- [ ] !medium Update the runbook
- [ ] !low Tidy up log formatting
- [x] !! Rotate the leaked credentials
- [ ] Weekly backup check
The shorthand marker must come first (right after the checkbox) and be followed by a space, so - [ ] !important note is left untouched. Works with -, *, + bullets and both [ ] / [x] states.
Levels
Four built-in levels, plus any custom level you add via config (blocker below is an example):
| Level | Origin | Keyword | Renders as |
|---|---|---|---|
| Low | built-in | !low |
|
| Medium | built-in | !medium |
|
| High | built-in | !high |
|
| Critical | built-in | !critical |
|
| Blocker | example custom | !blocker |
|
| Todo | example custom | !todo |
The default backgrounds are low green, medium amber, high orange, critical red. The ! / !! task-list shorthand always maps to high / critical; lower levels are used via their inline keyword (!low, !medium). Badge text color (black or white) is chosen automatically for legibility against each background.
Custom / extra levels
The levels option is a name → color map that is merged over the built-ins, so you can recolor a level or add your own:
# zensical.toml
[project.markdown_extensions.markdown_priority_badges.levels]
blocker = "#7b1fa2" # a new purple level, used as !blocker
todo = "#1565c0" # a new blue level, used as !todo
low = "#1b5e20" # recolor a built-in
# plain Python-Markdown
from markdown_priority_badges import PriorityBadgesExtension
markdown.markdown(text, extensions=["pymdownx.tasklist", PriorityBadgesExtension(levels={"blocker": "#7b1fa2"})])
Colors may be 3- or 6-digit hex (#7b1fa2, #eee) or a common CSS name (red, yellow, rebeccapurple); the badge text color auto-contrasts against them.
Install & enable
uv add markdown-priority-badges
(or pip install markdown-priority-badges)
Zensical (zensical.toml):
[project.markdown_extensions.markdown_priority_badges]
Plain Python-Markdown:
markdown.markdown(text, extensions=["pymdownx.tasklist", "markdown_priority_badges"])
The badge renders as <span class="task-prio task-prio--<level>" style="...">...</span>. The task-prio classes are kept for optional site-side overriding, but no CSS is needed by default.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file markdown_priority_badges-0.1.0.tar.gz.
File metadata
- Download URL: markdown_priority_badges-0.1.0.tar.gz
- Upload date:
- Size: 128.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34e6088a2811af12dafecc0b31eb9a9894e3f5efa8b51034af612738746dd303
|
|
| MD5 |
2a24a1e0bd4dd9b73926e7075172bed4
|
|
| BLAKE2b-256 |
74a4eb9216f317d9000c0cb813b79d0e5e4a959372090abf7788b95868e66f7f
|
Provenance
The following attestation bundles were made for markdown_priority_badges-0.1.0.tar.gz:
Publisher:
publish.yml on antoinekh/markdown-priority-badges
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markdown_priority_badges-0.1.0.tar.gz -
Subject digest:
34e6088a2811af12dafecc0b31eb9a9894e3f5efa8b51034af612738746dd303 - Sigstore transparency entry: 2036744424
- Sigstore integration time:
-
Permalink:
antoinekh/markdown-priority-badges@a2fc89b53145ca97cfe7a1c84f140e624c0c88af -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/antoinekh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a2fc89b53145ca97cfe7a1c84f140e624c0c88af -
Trigger Event:
release
-
Statement type:
File details
Details for the file markdown_priority_badges-0.1.0-py3-none-any.whl.
File metadata
- Download URL: markdown_priority_badges-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e699aeda0027f8aa75339fb287d1a9f960082eaf38d3ecc420e3ab4fb222e0a3
|
|
| MD5 |
c3a47dcb5d4e6a72103858d5476ee6b0
|
|
| BLAKE2b-256 |
8b867fc007038edce18322c5cc829b9a50e3fe83fe7fc886ca2690fc3840b192
|
Provenance
The following attestation bundles were made for markdown_priority_badges-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on antoinekh/markdown-priority-badges
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markdown_priority_badges-0.1.0-py3-none-any.whl -
Subject digest:
e699aeda0027f8aa75339fb287d1a9f960082eaf38d3ecc420e3ab4fb222e0a3 - Sigstore transparency entry: 2036744831
- Sigstore integration time:
-
Permalink:
antoinekh/markdown-priority-badges@a2fc89b53145ca97cfe7a1c84f140e624c0c88af -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/antoinekh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a2fc89b53145ca97cfe7a1c84f140e624c0c88af -
Trigger Event:
release
-
Statement type: