SyntaxHighlighter
ClassFor examples and usage details, see the component documentation.
View SyntaxHighlighter ComponentNamespace:
RazorConsole.ComponentsAssembly:
RazorConsole.CoreDefinition
public class SyntaxHighlighter : ComponentBase, IComponent, IHandleEvent, IHandleAfterRenderConstructors
1| Name | Type | Description |
|---|---|---|
SyntaxHighlighter() | Constructor | — |
Properties
7| Name | Type | Description |
|---|---|---|
Appearance | ||
TabWidth | Nullable<Int32> | Width of tab characters in spaces. When specified and greater than 0, overrides tab width in Options. |
Other | ||
AdditionalAttributes | IReadOnlyDictionary<String, Object> | Additional HTML attributes for the syntax highlighter element. |
Code | String | Source code to highlight. |
Language | String | Programming language of the code. If null , attempts automatic detection. Supported: "csharp", "javascript", "python", "sql", etc. |
Options | SyntaxOptions | Additional syntax highlighting options. If null , uses Default. |
ShowLineNumbers | Boolean | Whether line numbers should be displayed. Default is false . |
Theme | String | Color theme for syntax highlighting. If null , uses default theme. |
Methods
2| Name | Type | Description |
|---|---|---|
BuildRenderTree(RenderTreeBuilder)() | Method | — |
OnParametersSet() | Method | Called when component parameters are set. Processes the code through syntax highlighting and encodes the result. |