extensions

package
v0.0.0-...-e682752 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WikiLinkAttributeFilter = html.GlobalAttributeFilter

WikiLinkAttributeFilter defines attribute names which WikiLink elements can have.

View Source
var WikiLinker = &wikiLinker{}

WikiLinker is an extension that allow you to parse text that seems like a URL.

Functions

func NewWikiLinker

func NewWikiLinker(opts ...WikiLinkerOption) goldmark.Extender

func NewWikiLinkerHTMLRenderer

func NewWikiLinkerHTMLRenderer(opts ...html.Option) renderer.NodeRenderer

NewWikiLinkerHTMLRenderer returns a new WikiLinkerHTMLRenderer.

func NewWikiLinkerParser

func NewWikiLinkerParser(opts ...WikiLinkerOption) parser.InlineParser

Types

type WikiLinkResolver

type WikiLinkResolver interface {
	Resolve(dest []byte) (actual []byte, classes [][]byte)
}

WikiLinkResolver resolves link destinations. If actual == nil parsing is skipped. CSS classes returned here are applied to the resulting <a>.

type WikiLinkerConfig

type WikiLinkerConfig struct {
	WikiLinkRegexp *regexp.Regexp

	WikiLinkResolver
}

type WikiLinkerOption

type WikiLinkerOption interface {
	parser.Option
	SetWikiLinkerOption(*WikiLinkerConfig)
}

func WithCustomResolver

func WithCustomResolver(value WikiLinkResolver) WikiLinkerOption

WithCustomResolver is a functional option to define how WikiLinks are resolved.

func WithUnderscoreResolver

func WithUnderscoreResolver() WikiLinkerOption

WithUnderscoreResolver replaces all whitespace in WikiLinks with underscores. Contiguous spaces are merged into a single underscore.

e.g.: `[[ Disambiguation (Disambiguation) ]]` becomes `Disambiguation_(Disambiguation)`

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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