Skip to main content

render_str

Function render_str 

Source
pub fn render_str(input: &str) -> Result<String, LexError>
Expand description

Single-pass render: parses and renders markup in one pass, avoiding intermediate Vec<Token>.

When colors are enabled, scans the input for tags and emits ANSI sequences directly. When disabled, validates markup and strips all tags.

ยงErrors

Returns LexError on unclosed tags or malformed tag content. Note: this is the optimized single-pass entry point used by the farben crate. External consumers calling render + tokenize separately will also work, but this function avoids the intermediate Vec<Token> allocation.