preprocess

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package preprocess converts a markdown document into a tree of headings for easy querying.

Index

Constants

This section is empty.

Variables

View Source
var KindTreeBranch = ast.NewNodeKind("TreeBranch")

Functions

This section is empty.

Types

type Tree

type Tree struct {
	Doc    TreeBranch
	Source []byte
}

A markdown document parsed into a tree of goldmark AST nodes.

func GoldmarkToTree

func GoldmarkToTree(doc ast.Node, source []byte) (Tree, error)

Converts an already parsed goldmark ast into a Heading tree

type TreeBranch

type TreeBranch struct {
	ast.BaseInline
	TreeParent *TreeBranch
	Level      int
}

Represents a branch in the document tree, triggered by a heading. This is also implements goldmark/ast.Node, so it can be used with AST tools.

func NewTreeBranch

func NewTreeBranch(heading *ast.Heading, parent *TreeBranch) *TreeBranch

func NewTreeBranchRoot

func NewTreeBranchRoot() *TreeBranch

A tree branch for the root of the document.

func (*TreeBranch) Dump

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

func (*TreeBranch) Kind

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

Jump to

Keyboard shortcuts

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