markdown-it-py plugin to add ID attribute support to headings
Project description
mdit-py-heading-attrs
mdit-py-heading-attrs is a markdown-it-py plugin to add attribute support to headings. Currently, only anchors are supported.
Example
Input markdown:
## Getting Started {#getting-started}
Output HTML:
<h2 id="getting-started">Getting Started</h2>
Installation
pip install mdit-py-heading-attrs
Or with uv:
uv add mdit-py-heading-attrs
Usage
from markdown_it import MarkdownIt
from mdit_py_heading_attrs import heading_attrs_plugin
md = MarkdownIt().use(heading_attrs_plugin)
markdown = """
## Getting Started {#getting-started}
"""
html = md.render(markdown)
print(html)
Output:
<h2 id="getting-started">Getting Started</h2>
Syntax
Add an ID to any heading using {#id} syntax at the end:
## Heading {#my-id}
Supported Heading Formats
# ATX heading {#h1-id}
## ATX heading {#h2-id}
### ATX heading {#h3-id}
## ATX with closing ## {#my-id}
Setext H1 {#setext-h1}
==========
Setext H2 {#setext-h2}
----------
Escaping
Use backslash to escape braces if you want them to render literally:
## Code Example \{not-an-id\}
Renders as:
<h2>Code Example {not-an-id}</h2>
See Also
- mdit-py-plugins: collection of core plugins for markdown-it-py.
- mdit-py-figure: plugin to parse markdown paragraphs that start with an image into HTML
<figure>elements.
Changelog
See CHANGELOG.md.
License
Apache-2.0
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 mdit_py_heading_attrs-1.0.0.tar.gz.
File metadata
- Download URL: mdit_py_heading_attrs-1.0.0.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e5dec03d56a1fb7eb06751c3b29aabf03e08dfc72d47d16aa643abe75ee4913
|
|
| MD5 |
0f3070cd8f5d7c307855ea9c34f11226
|
|
| BLAKE2b-256 |
61ec69ee7c6829709f1608669176ab50e30def86f0af17d40557c57b258af9bb
|
Provenance
The following attestation bundles were made for mdit_py_heading_attrs-1.0.0.tar.gz:
Publisher:
pypi_upload.yml on mangoumbrella/mdit-py-heading-attrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdit_py_heading_attrs-1.0.0.tar.gz -
Subject digest:
8e5dec03d56a1fb7eb06751c3b29aabf03e08dfc72d47d16aa643abe75ee4913 - Sigstore transparency entry: 780697413
- Sigstore integration time:
-
Permalink:
mangoumbrella/mdit-py-heading-attrs@6e31621a7f746e56c5a452c66e80114a539c20cc -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mangoumbrella
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_upload.yml@6e31621a7f746e56c5a452c66e80114a539c20cc -
Trigger Event:
release
-
Statement type:
File details
Details for the file mdit_py_heading_attrs-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mdit_py_heading_attrs-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
558d2b93e73592e3a5ebeb2e283701faf6ee4215b7e155fa782d728655b082bf
|
|
| MD5 |
da4ca49a029f7298b8b249bd0f8f3f60
|
|
| BLAKE2b-256 |
4bb1fd2e3ca7e0c3489962634d02b00e3aece0c6706e2d8017fdf1f0edf7d0fe
|
Provenance
The following attestation bundles were made for mdit_py_heading_attrs-1.0.0-py3-none-any.whl:
Publisher:
pypi_upload.yml on mangoumbrella/mdit-py-heading-attrs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mdit_py_heading_attrs-1.0.0-py3-none-any.whl -
Subject digest:
558d2b93e73592e3a5ebeb2e283701faf6ee4215b7e155fa782d728655b082bf - Sigstore transparency entry: 780697414
- Sigstore integration time:
-
Permalink:
mangoumbrella/mdit-py-heading-attrs@6e31621a7f746e56c5a452c66e80114a539c20cc -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mangoumbrella
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_upload.yml@6e31621a7f746e56c5a452c66e80114a539c20cc -
Trigger Event:
release
-
Statement type: