quick

package
Version: v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 5 Imported by: 7

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.

Source Files

Jump to

Keyboard shortcuts

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