Skip to main content

MARKDOWN_MAX_OPEN_BLOCKS

Constant MARKDOWN_MAX_OPEN_BLOCKS 

Source
pub const MARKDOWN_MAX_OPEN_BLOCKS: usize = 128;
Expand description

The most container blocks (block quotes and list items) a Markdown file may hold open at once and still be parsed. The Markdown grammar’s block scanner saves its open blocks into tree-sitter’s fixed 1024-byte state buffer without a bounds check, 4 bytes per block after a 5-byte header, so 255 open blocks overrun it and tree-sitter aborts the whole process (tree-sitter-md 0.5.3 under tree-sitter 0.26). Half that leaves room for the overestimate markdown_too_deep_to_parse makes.