[][src]Function syntect::html::highlighted_html_for_string

pub fn highlighted_html_for_string(
    s: &str,
    ss: &SyntaxSet,
    syntax: &SyntaxReference,
    theme: &Theme
) -> String

Convenience method that combines start_highlighted_html_snippet, styled_line_to_highlighted_html and HighlightLines from syntect::easy to create a full highlighted HTML snippet for a string (which can contain many lines).

Note that the syntax passed in must be from a SyntaxSet compiled for newline characters. This is easy to get with SyntaxSet::load_defaults_newlines(). (Note: this was different before v3.0)