Skip to content

comfit.render_html

Python
render_html(source: str, language: str, theme: str, config: RenderHtmlConfig | None = None) -> str

Render escaped HTML with a bundled theme.

Class styles need a stylesheet. Variable styles need CSS variables. Parsing and rendering release the GIL.

Raises:

  • ValueError – A theme, language, or source range is invalid.
  • RuntimeError – The backend fails or injection nesting exceeds 32 layers.