chroma

package
v0.0.0-...-2947a06 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: BSD-2-Clause-Views, BSD-2-Clause-Views Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HTMLFormatter = NewHTMLFormatter()

Functions

func FormatHTML

func FormatHTML(fileName, content string) template.HTML

func Lexer

func Lexer(name, content string) chroma.Lexer

func WriteCSS

func WriteCSS(w io.Writer, styleName string) error

Types

type CSSAttrs

type CSSAttrs map[string]string

func (CSSAttrs) String

func (attrs CSSAttrs) String() string

String creates a canonical string for the given CSS attributes.

type Formatter

type Formatter struct {
	TabWidth            int
	Prefix              string
	LineNumbers         bool
	LineNumbersInTable  bool
	LinkableLineNumbers bool
	LineNumbersIDPrefix string
	BaseLineNumber      int
}

Formatter that generates HTML.

func NewHTMLFormatter

func NewHTMLFormatter() *Formatter

NewHTMLFormatter configures an HTML formatter.

func (*Formatter) Format

func (f *Formatter) Format(w io.Writer, iterator chroma.Iterator) (err error)

func (*Formatter) WriteCSS

func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) (err error)

WriteCSS writes CSS style definitions (without any surrounding HTML).

Jump to

Keyboard shortcuts

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