Function syntect::html::highlighted_snippet_for_string
[−]
[src]
pub fn highlighted_snippet_for_string(s: &str, syntax: &SyntaxDefinition, theme: &Theme) -> String
Convenience method that combines start_coloured_html_snippet
, styles_to_coloured_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 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.