Module syntect::html [] [src]

Rendering highlighted code as HTML+CSS

Enums

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 colour attributes are generated

Functions

highlighted_snippet_for_file

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.

highlighted_snippet_for_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).

start_coloured_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_snippet_for_string.

styles_to_coloured_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

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).