dtkt.protoui.v1beta1protoui.protoCodeBlock
MessageRender as a code block with optional syntax highlighting.
Maps to Code/CodeBlock in @dtkt/ui/text or syntax highlighter components
Supports text, CEL expressions, and templates for generating code content.
The message or field is available as this in expression/template context.
Example expr: this.code or this.function_body
Example template: Use Go templates to format code
| Field | Type | Number | Description |
|---|---|---|---|
| content | Data dtkt.protoui.v1beta1.Data | 1 | The code content. Can be plain text, a CEL expression, or a template.
Context: |
| language | string | 2 | Language for syntax highlighting (e.g., "go", "python", "javascript"). |
| filename | string | 3 | Optional filename to display. |
| show_line_numbers | bool | 4 | Show line numbers. |
| highlight_lines | string | 5 | Highlight specific lines (e.g., "1-3,5,7-9"). |