Skip to main content

mdit-py-heading-attrs

PyPI version Python versions License

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

Metadata

Release files for mdit-py-heading-attrs 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdit-py-heading-attrs 1.0.0
File Size Uploaded Provenance Actions
mdit_py_heading_attrs-1.0.0.tar.gz 22.5 kB With provenance Details for mdit_py_heading_attrs-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mdit-py-heading-attrs 1.0.0
File Interpreter ABI Platform Actions
mdit_py_heading_attrs-1.0.0-py3-none-any.whl Python 3 none any Details for mdit_py_heading_attrs-1.0.0-py3-none-any.whl

Total release size: 31.9 kB

Release files / mdit_py_heading_attrs-1.0.0.tar.gz

Download URL mdit_py_heading_attrs-1.0.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8e5dec03d56a1fb7eb06751c3b29aabf03e08dfc72d47d16aa643abe75ee4913
BLAKE2b-256 checksum
How to use checksums
61ec69ee7c6829709f1608669176ab50e30def86f0af17d40557c57b258af9bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 28, 2025.

Transparency log

Release files / mdit_py_heading_attrs-1.0.0-py3-none-any.whl

Download URL mdit_py_heading_attrs-1.0.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
558d2b93e73592e3a5ebeb2e283701faf6ee4215b7e155fa782d728655b082bf
BLAKE2b-256 checksum
How to use checksums
4bb1fd2e3ca7e0c3489962634d02b00e3aece0c6706e2d8017fdf1f0edf7d0fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 28, 2025.

Transparency log

Security for mdit-py-heading-attrs 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mdit_py_heading_attrs-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 28, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page