Skip to main content

Module pymdown_blocks

Module pymdown_blocks 

Source
Expand description

PyMdown Extensions Blocks detection utilities

This module provides detection for PyMdown Extensions “Blocks” syntax which uses /// markers to create structured content blocks.

Common patterns:

  • /// caption - Caption block for figures/tables
  • /// details | Summary title - Collapsible content
  • /// admonition | Title - Admonition with custom title
  • /// html | div - HTML wrapper block
  • /// - Closing marker

Blocks can have YAML options indented 4 spaces after the header line:

/// caption
    attrs: {id: my-id}
Caption text
///

Supported block types: caption, figure-caption, details, admonition, html, definition, tab

Structs§

BlockTracker
Track block nesting state for a document

Functions§

detect_block_ranges
Detect PyMdown block ranges in content Returns a vector of byte ranges (start, end) for each block
extract_block_args
Extract arguments from a block opening line (text after |)
extract_block_type
Extract the block type from an opening line Returns the block type like “caption”, “details”, “admonition”, etc.
get_block_indent
Get the indentation level of a block marker
is_block_close
Check if a line is a block closing marker (just ///)
is_block_open
Check if a line is a block opening marker
is_within_block_ranges
Check if a byte position is within a block