hl

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultDarkStyle  = styles.Monokai
	DefaultLightStyle = styles.SolarizedLight
)

Styles used if the user hasn't set a style in the config.

View Source
var Style = prefs.NewString("", prefs.StringMeta{
	Name:    "Code Highlight Style",
	Section: "Text",
	Description: "For reference, see the " +
		`<a href="https://xyproto.github.io/splash/docs/all.html">Chroma Style Gallery</a>.`,
	Placeholder: "Leave blank for default",
	Validate: func(style string) error {

		return nil
	},
})

Functions

func ChangeStyle

func ChangeStyle(styleName string) error

ChangeStyle changes the global highlighter style. It is a helper function for the Style variable.

func Highlight

func Highlight(ctx context.Context, start, end *gtk.TextIter, language string)

Highlight highlights the code section starting from start to end using the lexer of the given language. The start and end iterators will be invalidated, but the end iterator will have its previous offset restored.

Types

This section is empty.

Jump to

Keyboard shortcuts

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