Function syntect::html::highlighted_snippet_for_file [] [src]

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

Convenience method that combines start_coloured_html_snippet, styles_to_coloured_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 no newline characters. This is easy to get with SyntaxSet::load_defaults_nonewlines(). If you think this is the wrong choice of SyntaxSet to accept, I'm not sure of it either, email me.