Rendering highlighted code as HTML+CSS
ClassedHTMLGenerator | Output HTML for a line of code with <span> elements using class names
As this has to keep track of open and closed <span> tags, it is a struct
with additional state.
|
ClassStyle | Only one style for now, I may add more class styles later.
Just here so I don't have to change the API
|
IncludeBackground | Determines how background color attributes are generated
|
append_highlighted_html_for_styled_line | Like styled_line_to_highlighted_html but appends to a String for increased efficiency.
In fact styled_line_to_highlighted_html is just a wrapper around this function.
|
highlighted_html_for_file | 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.
|
highlighted_html_for_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).
|
start_highlighted_html_snippet | Returns a <pre style="...">\n tag with the correct background color for the given theme.
This is for if you want to roll your own HTML output, you probably just want to use
highlighted_html_for_string .
|
styled_line_to_highlighted_html | Output HTML for a line of code with <span> elements using inline
style attributes to set the correct font attributes.
The bg attribute determines if the spans will have the background-color
attribute set. See the IncludeBackground enum's docs.
|
tokens_to_classed_html | Deprecated |
tokens_to_classed_spans | 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).
|