Expand description
Utilities for extracting custom header IDs from various Markdown flavors
This module supports multiple syntax formats for custom header IDs:
§Kramdown Format
{#custom-id}- Simple ID without colon- Example:
# Header {#my-id}
§Python-markdown attr-list Format
{:#custom-id}- ID with colon, no spaces{: #custom-id}- ID with colon and spaces{: #custom-id .class}- ID with classes{: #custom-id .class data="value"}- ID with full attributes- Example:
# Header {: #my-id .highlight}
§Position Support
- Inline:
# Header {#id}(all formats) - Next-line: Jekyll/kramdown style where attr-list appears on the line after the header
# Header {#next-line-id}
The module provides functions to detect and extract IDs from both inline and standalone (next-line) attr-list syntax.
Functions§
- extract_
header_ id - Extract custom header ID from a line if present, returning clean text and ID
- extract_
standalone_ attr_ list_ id - Extract ID from a standalone attr-list line
- is_
standalone_ attr_ list - Check if a line is a standalone attr-list (Jekyll/kramdown style)