Skip to main content

Module syntax

Module syntax 

Source
Expand description

Syntax highlighting.

Port of rich/syntax.py’s renderable surface, powered by the syntect crate. A Syntax highlights a block of source code for a given language and theme, producing colored Segments (a solid block: each line is padded to the render width with the theme background).

Divergence: upstream uses Pygments; we use syntect, which ships different grammars and themes. So the coloring is functional, not byte-identical to Python rich — see docs/DIVERGENCES.md. Everything else (the renderable protocol, width handling) matches the port’s conventions.

Structs§

Syntax
A block of syntax-highlighted source code. Mirrors rich.syntax.Syntax.