Skip to main content

Module syntax

Module syntax 

Source
Expand description

Syntax highlighting module for terminal display.

Provides the Syntax struct for rendering syntax-highlighted code with line numbers, themes, word wrap, and padding. Uses syntect for syntax highlighting (analogous to the use of Pygments).

Structs§

Syntax
Syntax-highlighted code display.

Enums§

PaddingSpec
Shorthand input for unpack_padding — accepts the same forms as CSS padding: a single value, two values (vertical, horizontal), three values (top, horizontal, bottom), or four values (top, right, bottom, left).
SyntaxError
Errors that can occur during syntax operations.

Functions§

unpack_padding
Expand a PaddingSpec into a (top, right, bottom, left) tuple, matching rich v14.1.0’s Padding.unpack and the CSS padding shorthand convention.