codeview

package
v0.0.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

templ: version: v0.3.977

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeView

func CodeView(props Props) templ.Component

CodeView renders a syntax-highlighted code block with a copy button.

func Highlight

func Highlight(code, lang string) string

Highlight takes source code and a language name and returns syntax-highlighted HTML. Uses Chroma for tokenization with DaisyUI color variables as inline styles. Supported languages: "go", "templ", "html", "js", "css", "sql", "json", "yaml", "sh".

Types

type CopySignals

type CopySignals struct {
	Copied bool `json:"copied"`
}

CopySignals holds the reactive state for the copy button.

type Props

type Props struct {
	ID         string
	Class      string
	Attributes templ.Attributes
	Code       string // source code to display
	Language   string // "go", "templ", "html", "sh", etc.
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL