Documentation
¶
Overview ¶
templ: version: v0.3.1020
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render returns a Chroma-highlighted <pre><code>…</code></pre> fragment as raw HTML, suitable for injection via templ.Raw.
Token spans use the "ch-" class prefix; css/codeblock.css maps a small subset of those classes to a 4-color palette. Unknown languages fall back to plain (escaped) text inside <pre><code>.
Types ¶
type Config ¶
type Config struct {
// Language selects the Chroma lexer (e.g. "go", "bash", "html", "css").
// "templ" aliases to the Go lexer. Unknown values fall back to plain text.
Language string
// Code is the source code to display
Code string
// Label is the header text (defaults to Language if empty)
Label string
// MaxHeight is an optional CSS max-height for scrollable long code (e.g. "400px")
MaxHeight string
// Density controls spacing in the header and highlighted code body.
Density Density
// ID overrides the auto-generated element ID
ID string
}
Config holds configuration for the code block component
type Density ¶ added in v0.1.5
type Density string
Density controls spacing inside code block regions.
type Instance ¶ added in v0.0.12
type Instance struct {
// contains filtered or unexported fields
}
Instance is a renderable code block component.
func (Instance) Kind ¶ added in v0.0.12
func (Instance) Kind() components.Kind
Kind identifies the component as a code block.
Click to show internal directories.
Click to hide internal directories.