Skip to main content

Module pandoc

Module pandoc 

Source
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 : text line 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 @key citations.
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 lang is 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 lang is 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.