Function syntect::html::tokens_to_classed_html [] [src]

pub fn tokens_to_classed_html(
    line: &str,
    ops: &[(usize, ScopeStackOp)],
    style: ClassStyle
) -> String

Output HTML for a line of code with <span> elements specifying classes for each token. The span elements are nested like the scope stack and the scopes are mapped to classes based on the ClassStyle (see it's docs).

For this to work correctly you must concatenate all the lines in a <pre> tag since some span tags opened on a line may not be closed on that line and later lines may close tags from previous lines.