parser

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScrollAnchor = "mpls-scroll-anchor"
)

Variables

View Source
var (
	CodeHighlightingStyle string
	EnableWikiLinks       bool
	WorkspaceRoot         string

	EnableFootnotes bool
	EnableEmoji     bool
)
View Source
var KindGitHubAlert = ast.NewNodeKind("GitHubAlert")

KindGitHubAlert is the NodeKind for a GitHub alert node.

Functions

func CleanupDocumentContent added in v0.17.1

func CleanupDocumentContent(uri string)

func ClearImageCache added in v0.20.0

func ClearImageCache()

ClearImageCache clears the image cache. Useful for testing.

func HTML

func HTML(document, uri string, changeLine int) (string, map[string]any)

func NormalizePath added in v0.14.0

func NormalizePath(uri string) string

Types

type AlertType added in v0.20.0

type AlertType int

AlertType represents the type of a GitHub-style alert.

const (
	AlertNote AlertType = iota
	AlertTip
	AlertImportant
	AlertWarning
	AlertCaution
)

func (AlertType) CSSClass added in v0.20.0

func (t AlertType) CSSClass() string

CSSClass returns the CSS class suffix for the alert type.

func (AlertType) SVGIcon added in v0.20.0

func (t AlertType) SVGIcon() string

SVGIcon returns the GitHub-matching SVG icon for the alert type.

func (AlertType) String added in v0.20.0

func (t AlertType) String() string

String returns the display label for the alert type.

type GitHubAlertExtension added in v0.20.0

type GitHubAlertExtension struct{}

GitHubAlertExtension is a Goldmark extension that adds support for GitHub-style alerts (admonitions).

func (*GitHubAlertExtension) Extend added in v0.20.0

func (e *GitHubAlertExtension) Extend(m goldmark.Markdown)

Extend adds the GitHub alert transformer and renderer to Goldmark.

type GitHubAlertNode added in v0.20.0

type GitHubAlertNode struct {
	ast.BaseBlock
	AlertType AlertType
}

GitHubAlertNode is a custom AST node representing a GitHub-style alert.

func (*GitHubAlertNode) Dump added in v0.20.0

func (n *GitHubAlertNode) Dump(source []byte, level int)

Dump dumps the node for debugging.

func (*GitHubAlertNode) Kind added in v0.20.0

func (n *GitHubAlertNode) Kind() ast.NodeKind

Kind returns the kind of this node.

type GitHubAlertRenderer added in v0.20.0

type GitHubAlertRenderer struct{}

GitHubAlertRenderer renders GitHubAlertNode nodes to HTML.

func (*GitHubAlertRenderer) RegisterFuncs added in v0.20.0

RegisterFuncs registers the renderer function for GitHubAlertNode.

type GitHubAlertTransformer added in v0.20.0

type GitHubAlertTransformer struct{}

GitHubAlertTransformer is an AST transformer that converts blockquotes with [!TYPE] markers into GitHubAlertNode nodes.

func (*GitHubAlertTransformer) Transform added in v0.20.0

func (t *GitHubAlertTransformer) Transform(doc *ast.Document, reader text.Reader, _ parser.Context)

Transform walks the AST and replaces qualifying blockquotes with alert nodes.

type LinkResolverTransformer added in v0.17.0

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

func (*LinkResolverTransformer) Transform added in v0.17.0

func (t *LinkResolverTransformer) Transform(doc *ast.Document, _ text.Reader, _ parser.Context)

type ScrollIDTransformer added in v0.15.0

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

func (*ScrollIDTransformer) Transform added in v0.15.0

func (t *ScrollIDTransformer) Transform(doc *ast.Document, reader text.Reader, _ parser.Context)

Jump to

Keyboard shortcuts

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