textual.highlight
HighlightTheme
¶
Contains the style definition for user with the highlight method.
guess_language
¶
highlight
¶
highlight(
code,
*,
language=None,
path=None,
theme=HighlightTheme,
tab_size=8
)
Apply syntax highlighting to a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
A string to highlight. |
required |
|
str | None
|
The language to highlight. |
None
|
|
type[HighlightTheme]
|
A HighlightTheme class (type not instance). |
HighlightTheme
|
|
int
|
Number of spaces in a tab. |
8
|
Returns:
Type | Description |
---|---|
Content
|
A Content instance which may be used in a widget. |