rs_rich.syntax¶
Generated from the type stubs by scripts/gen_python_api.py; do not edit.
rich.syntax: Syntax, plus the port's code-highlighter choice.
Syntax(..., highlighter="syntect") (or "lumis" in a lumis build)
picks the engine by name; code_highlighters() lists the names and
code_themes(name) an engine's themes. Rich highlights with Pygments, so
token colours differ from Rich's (see docs/python/syntax.md).
Syntax ¶
from_path
classmethod
¶
from_path(path: str, encoding: str = 'utf-8', lexer: Optional[str] = None, theme: Optional[str] = 'monokai', dedent: bool = False, line_numbers: bool = False, line_range: Optional[Tuple[int, int]] = None, start_line: int = 1, highlight_lines: Optional[set] = None, code_width: Optional[int] = None, tab_size: int = 4, word_wrap: bool = False, background_color: Optional[str] = None, indent_guides: bool = False, padding: PaddingDimensions = 0, highlighter: Optional[Union[str, CodeHighlighter, Any]] = None) -> Syntax
highlight ¶
stylize_range ¶
stylize_range(style: StyleType, start: Tuple[int, int], end: Tuple[int, int], style_before: bool = False) -> None
code_highlighters ¶
The code highlighters this build has (syntect; lumis in a lumis build).
code_themes ¶
The theme names a code highlighter accepts (default: syntect).