Skip to main content

code_info_span

Function code_info_span 

Source
pub fn code_info_span(source: &str, block_start: usize) -> Option<Range<usize>>
Expand description

The source range of a fenced code block’s info string — everything on the opening line past the fence (```rust → the rust). block_start is the code block node’s span.start. None for an indented code block, which opens with no fence to carry one. The range is empty for a fence written bare (``` alone), which is exactly where a language would be inserted.

Shared by the WYSIWYG builder (to label the box) and crate::Doc (to edit the label through a prompt), so the two agree on where the language lives.