Expand description
Rendering highlighted code as HTML+CSS
Structs§
- ClassedHTMLGenerator 
- Output HTML for a line of code with <span>elements using class names
Enums§
- ClassStyle 
- IncludeBackground 
- Determines how background color attributes are generated
Functions§
- append_highlighted_ html_ for_ styled_ line 
- Like styled_line_to_highlighted_htmlbut appends to aStringfor increased efficiency. In factstyled_line_to_highlighted_htmlis just a wrapper around this function.
- css_for_ theme Deprecated 
- css_for_ theme_ with_ class_ style 
- Create a complete CSS for a given theme. Can be used inline, or written to a CSS file.
- highlighted_html_ for_ file 
- Convenience method that combines start_highlighted_html_snippet,styled_line_to_highlighted_htmlandHighlightFilefromsyntect::easyto 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_htmlandHighlightLinesfromsyntect::easyto create a full highlighted HTML snippet for a string (which can contain many lines).
- line_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 theClassStyle(see it’s docs).
- start_highlighted_ html_ snippet 
- Returns a <pre style="...">\ntag 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.
- styled_line_ to_ highlighted_ html 
- Output HTML for a line of code with <span>elements using inlinestyleattributes to set the correct font attributes. Thebgattribute determines if the spans will have thebackground-colorattribute set. See theIncludeBackgroundenum’s docs.
- tokens_to_ classed_ html Deprecated 
- tokens_to_ classed_ spans Deprecated 
- Preserved for compatibility, always use line_tokens_to_classed_spansand keep aScopeStackbetween lines for correct highlighting that won’t sometimes crash.