Expand description
Rendering highlighted code as HTML+CSS
Structs§
- Output HTML for a line of code with
<span>
elements using class names
Enums§
- Determines how background color attributes are generated
Functions§
- Like
styled_line_to_highlighted_html
but appends to aString
for increased efficiency. In factstyled_line_to_highlighted_html
is just a wrapper around this function. - css_for_themeDeprecated
- Create a complete CSS for a given theme. Can be used inline, or written to a CSS file.
- Convenience method that combines
start_highlighted_html_snippet
,styled_line_to_highlighted_html
andHighlightFile
fromsyntect::easy
to create a full highlighted HTML snippet for a file. - Convenience method that combines
start_highlighted_html_snippet
,styled_line_to_highlighted_html
andHighlightLines
fromsyntect::easy
to create a full highlighted HTML snippet for a string (which can contain many lines). - 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 theClassStyle
(see it’s docs). - 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 usehighlighted_html_for_string
. - Output HTML for a line of code with
<span>
elements using inlinestyle
attributes to set the correct font attributes. Thebg
attribute determines if the spans will have thebackground-color
attribute set. See theIncludeBackground
enum’s docs. - tokens_to_classed_htmlDeprecated
- tokens_to_classed_spansDeprecatedPreserved for compatibility, always use
line_tokens_to_classed_spans
and keep aScopeStack
between lines for correct highlighting that won’t sometimes crash.