parser

package
v0.0.0-...-770a8fd Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlockType

func GetBlockType(block string) int

func IsNumeric

func IsNumeric(r rune) bool

func ParseMDBlocks

func ParseMDBlocks(md string) []string

Types

type HtmlNode

type HtmlNode struct {
	Tag, Value string
	Children   []HtmlNode
	Props      map[string]string
}

func BlocksToHTMLNodes

func BlocksToHTMLNodes(blocks []string) ([]HtmlNode, error)

func NewHtmlNode

func NewHtmlNode(tag, value string, children []HtmlNode, props map[string]string) HtmlNode

func (*HtmlNode) ProcessInnerText

func (node *HtmlNode) ProcessInnerText()

func (*HtmlNode) PropsToHTML

func (node *HtmlNode) PropsToHTML() string

func (*HtmlNode) ToHTML

func (node *HtmlNode) ToHTML() string

func (*HtmlNode) UnescapeMD

func (node *HtmlNode) UnescapeMD()

type InertParserResult

type InertParserResult struct {
	Title string
	Body  string
}

func MDtoHTML

func MDtoHTML(src string) (InertParserResult, error)

type TextNode

type TextNode struct {
	TextType  int
	Text, URL string
}

func (TextNode) Split

func (node TextNode) Split(delim string, splitType int) ([]TextNode, error)

func (TextNode) SplitExp

func (node TextNode) SplitExp(pattern string, marshal func([]string) TextNode) ([]TextNode, error)

func (TextNode) SplitImageNodes

func (node TextNode) SplitImageNodes() ([]TextNode, error)

func (TextNode) SplitLinkNodes

func (node TextNode) SplitLinkNodes() ([]TextNode, error)

NOTE: This will also match images, and so should be run after SplitImageNodes

func (TextNode) ToHTMLNode

func (node TextNode) ToHTMLNode() (HtmlNode, error)

type TextNodeSlice

type TextNodeSlice []TextNode

func (TextNodeSlice) ForEach

func (nodeList TextNodeSlice) ForEach(f func(TextNode))

func (TextNodeSlice) Split

func (nodeList TextNodeSlice) Split(delim string, splitType int) ([]TextNode, error)

func (TextNodeSlice) SplitAll

func (nodeList TextNodeSlice) SplitAll() ([]TextNode, error)

func (TextNodeSlice) SplitFunc

func (nodeList TextNodeSlice) SplitFunc(split TextNodeSplitFunc) (TextNodeSlice, error)

func (TextNodeSlice) SplitImageNodes

func (nodeList TextNodeSlice) SplitImageNodes() ([]TextNode, error)

func (TextNodeSlice) SplitLinkNodes

func (nodeList TextNodeSlice) SplitLinkNodes() ([]TextNode, error)

func (TextNodeSlice) ToString

func (nodeList TextNodeSlice) ToString() string

type TextNodeSplitFunc

type TextNodeSplitFunc func(*TextNode) ([]TextNode, error)

Jump to

Keyboard shortcuts

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