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§

CodeBlockUtils
Utility functions for detecting and handling code blocks in Markdown
MarkdownCodeBlock
Information about a markdown code block for recursive formatting

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)