Expand description
Pandoc Markdown syntax detection.
This module provides detection for Pandoc Markdown constructs that affect
rumdl rule output: fenced divs (:::), attribute lists ({#id .class}),
citations ([@key]), bracketed spans ([text]{.class}), and other
Pandoc-specific syntax.
Pandoc is the foundation; the Quarto flavor extends it with Quarto-only syntax (executable code blocks, shortcodes, cell options) elsewhere in the codebase. Anything that’s pure Pandoc lives here.
Common patterns this module handles:
::: {.callout-note}— fenced div with class::: {#myid .class}— generic div with id and class:::— closing marker{#id .class key="value"}— Pandoc attribute lists@key,[@key],[-@key],[@a; @b]— citations
Structs§
- DivTracker
- Track div nesting state for a document
Functions§
- collect_
pandoc_ header_ slugs - Find headings in the document and return a set of their Pandoc slugs.
- detect_
bracketed_ span_ ranges - Detect Pandoc bracketed span ranges (
[text]{attrs}). - detect_
div_ block_ ranges - Detect fenced div block ranges in content. Returns a vector of byte ranges (start, end) for each div block.
- detect_
example_ list_ marker_ ranges - Detect Pandoc example-list marker ranges (
(@)/(@label)at line start). - detect_
example_ reference_ ranges - Detect Pandoc example reference ranges (
(@label)not at line start). - detect_
grid_ table_ ranges - Detect Pandoc grid tables. A grid table is a contiguous run of lines
where the first line is a
+---+---+border, followed by alternating content rows|...|and border rows, and ending in a border row. At least one content row is required. - detect_
inline_ code_ attr_ ranges - Detect Pandoc inline code attribute ranges.
- detect_
inline_ footnote_ ranges - Detect Pandoc inline footnote ranges (
^[note text]). - detect_
line_ block_ ranges - Detect Pandoc line blocks (consecutive lines starting with
|). - detect_
multi_ line_ table_ ranges - Detect Pandoc multi-line table ranges.
- detect_
pipe_ table_ caption_ ranges - Detect Pandoc pipe-table caption lines (
: caption) adjacent (above or below, separated by exactly one blank line) to a pipe table. A: textline not adjacent to a table is treated as a definition-list value and is not matched here. - detect_
subscript_ superscript_ ranges - Detect Pandoc subscript (
~x~) and superscript (^x^) ranges. - detect_
yaml_ metadata_ block_ ranges - Detect Pandoc YAML metadata blocks (
---...---or---...). Unlike standard frontmatter, these can appear anywhere in the document and there can be multiple per file. - find_
citation_ ranges - Find all citation ranges in content (byte ranges)
Returns ranges for both bracketed
[@key]and inline@keycitations. - get_
div_ indent - Get the indentation level of a div marker
- has_
citations - Quick check if text might contain citations
- has_
pandoc_ attributes - Check if a line contains Pandoc-style attributes
- is_
callout_ open - Check if a line is a callout block opening
- is_
div_ close - Check if a line is a div closing marker (just
:::) - is_
div_ open - Check if a line is a div opening marker
- is_
pandoc_ code_ class_ attr - Return true if
langis a Pandoc code-attribute language declaration: a brace-delimited attribute list containing at least one.class, e.g.{.python},{.haskell .numberLines},{#snippet .python startFrom="10"}. - is_
pandoc_ raw_ block_ lang - Return true if
langis a Pandoc raw-format declaration:{=html},{=latex}, etc. The format name must be non-empty and consist only of ASCII alphanumeric characters, underscores, or hyphens. - is_
within_ div_ block_ ranges - Check if a byte position is within a div block
- pandoc_
header_ slug - Compute the Pandoc-style slug for a heading text.