syntaxhighlight

package
v0.5.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTheme = "github-dark"

DefaultTheme is the chroma theme name used when none is configured. It is shared with CSSForTheme so the class output and the generated CSS agree.

Variables

This section is empty.

Functions

func AvailableThemes

func AvailableThemes() []string

AvailableThemes returns a list of built-in chroma theme names.

func CSSForTheme

func CSSForTheme(theme string) string

CSSForTheme returns the CSS stylesheet for the given chroma theme name. The returned CSS targets the class-based output from the HTML formatter.

func Highlight

func Highlight(code, lang string) string

Highlight returns HTML with CSS class annotations for the given code and language, using the default theme. Callers that know the configured code theme should use HighlightTheme so the emitted classes match the CSS.

func HighlightTheme added in v0.4.0

func HighlightTheme(code, lang, theme string) string

HighlightTheme is Highlight with an explicit chroma theme. The theme affects the token->class mapping, so it must match the stylesheet produced by CSSForTheme or the highlighted code is styled (or unstyled) incorrectly.

func NormalizeLanguage

func NormalizeLanguage(lang string) string

NormalizeLanguage normalizes common language aliases to chroma lexer names.

Types

This section is empty.

Jump to

Keyboard shortcuts

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