[][src]Function syntect::html::highlighted_html_for_file

pub fn highlighted_html_for_file<P: AsRef<Path>>(
    path: P,
    ss: &SyntaxSet,
    theme: &Theme
) -> Result<String>

Convenience method that combines start_highlighted_html_snippet, styled_line_to_highlighted_html and HighlightFile from syntect::easy to create a full highlighted HTML snippet for a file.

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)