Skip to main content

render_styled_html

Function render_styled_html 

Source
pub fn render_styled_html(
    text: &str,
    highlight_spans: &[HighlightSpan],
    theme: &Theme,
) -> String
Expand description

Render styled text with syntax highlighting to HTML with inline CSS

The generated HTML uses a <pre> block with inline styles for each syntax-highlighted span. This allows pasting into rich text editors like Google Docs, Word, etc.

§Arguments

  • text - The text to render
  • highlight_spans - Syntax highlighting spans with byte ranges and colors
  • theme - The theme to use for background and default foreground colors

§Returns

HTML string with inline styles