Skip to main content

syntax_spans

Function syntax_spans 

Source
pub fn syntax_spans(content: &str, extension: &str) -> Vec<SyntaxSpan>
Expand description

Find coarse keyword, comment, and number spans in source text.

extension is a bare lowercase suffix. Supported keyword tables are rs, js, jsx, ts, tsx, py, and go; unknown suffixes produce no keyword spans. Returned offsets are UTF-8 byte offsets and output is capped at 4,096 spans. This low-level helper is independent of the private syntect-based TUI renderer.