package quick

import "github.com/alecthomas/chroma/quick"

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

Example

Code:play 

package main

import (
	"log"
	"os"

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

func main() {
	code := `package main

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

Index

Examples

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.

Source Files

quick.go

Version
v0.10.0 (latest)
Published
Jan 12, 2022
Platform
js/wasm
Imports
5 packages
Last checked
6 hours ago

Tools for package owners.