Skip to main content

Module code_block_utils

Module code_block_utils 

Source
Expand description

Utility functions for detecting and handling code blocks and code spans in Markdown for rumdl.

Code block detection is delegated to pulldown-cmark, which correctly implements the CommonMark specification. This handles edge cases like:

  • Backtick fences with backticks in the info string (invalid per spec)
  • Nested fences (longer fence contains shorter fence as content)
  • Mixed fence types (tilde fence contains backticks as content)
  • Indented code blocks with proper list context handling

Structs§

CodeBlockDetail
Detailed information about a code block captured during parsing
CodeBlockUtils
Utility functions for detecting and handling code blocks in Markdown
MarkdownCodeBlock
Information about a markdown code block for recursive formatting
ParseResult
Result of the central pulldown-cmark parse, capturing all data needed by individual rules
StrongSpanDetail
A strong emphasis span captured during parsing

Enums§

CodeBlockContext
Classification of code blocks relative to list contexts

Type Aliases§

CodeRanges
Type alias for code block and span ranges: (code_blocks, code_spans)
LineToListMap
Ordered list membership: maps line number (1-indexed) to list ID
ListStartValues
Ordered list start values: maps list ID to the start value