Skip to main content

render

Function render 

Source
pub fn render(tokens: Vec<Token>) -> String
Expand description

Renders a token stream into a raw ANSI-escaped string.

Text tokens are appended as-is. Tag tokens are converted to their corresponding ANSI escape sequences. The active style stack persists across calls via thread-local state callers using non-bleed semantics should call clear_active_stack() after their reset.

§Example

let tokens = tokenize("[red]hello[/]")?;
let output = render(tokens);
assert_eq!(output, "\x1b[31mhello\x1b[0m");