package html

import "codeberg.org/anaseto/goal/scan/html"

Package html provides a simple html highlighter for Goal code working at the token level.

See cmd/goal2html/README.md for an example of styling with CSS.

Index

Types

type Highlighter

type Highlighter struct {
	// contains filtered or unexported fields
}

Highlighter represents an html syntax highlighter for Goal code.

func NewHighlighter

func NewHighlighter(opts Options) *Highlighter

NewHighlighter returns a new Highlighter initialized with the given options.

func (*Highlighter) Execute

func (h *Highlighter) Execute(w io.Writer, source string) error

Execute applies the highlighter with given source, writing the output to w.

type Options

type Options struct {
	Monads    []string // list of custom monadic keywords
	Dyads     []string // list of custom dyadic keywords
	NoShebang bool     // disable shebang scanning
	DisableIO bool     // disable default IO keywords
	Prefix    string   // prefix for HTML class names
}

Options represents the configurable parameters for NewHighlighter.

Source Files

highlight.go

Version
v1.1.0 (latest)
Published
Feb 17, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
58 minutes ago

Tools for package owners.