quick

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package quick provides simple, no-configuration source code highlighting.

Example
package main

import (
	"log"
	"os"

	"github.com/alecthomas/chroma/v2/quick"
)

func main() {
	code := `package main

func main() { }
`
	err := quick.Highlight(os.Stdout, code, "go", "html", "monokai")
	if err != nil {
		log.Fatal(err)
	}
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Highlight

func Highlight(w io.Writer, source, lexer, formatter, style string) error

Highlight some text.

Lexer, formatter and style may be empty, in which case a best-effort is made.

Types

This section is empty.

Jump to

Keyboard shortcuts

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