parser

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoChildren = gparser.NoChildren
	Close      = gparser.Close
)
View Source
var (
	NewContextKey     = gparser.NewContextKey
	ProcessDelimiters = gparser.ProcessDelimiters
)
View Source
var LinkReferenceParagraphTransformer = &linkReferenceParagraphTransformer{}

LinkReferenceParagraphTransformer is a ParagraphTransformer implementation that parses and extracts link reference from paragraphs.

View Source
var (
	NewReference = gparser.NewReference
)

Functions

func ActionAwareParsers

func ActionAwareParsers() gparser.Parser

func NewAutoLinkParser

func NewAutoLinkParser() gparser.InlineParser

NewAutoLinkParser returns a new InlineParser that parses autolinks with Go template action support

func NewTemplateActionParser

func NewTemplateActionParser() gparser.InlineParser

NewTemplateActionParser returns a new InlineParser that parses go template actions

Types

type Attribute

type Attribute struct {
	Name  []byte
	Value interface{}
}

An Attribute is an attribute of the markdown elements.

type Attributes

type Attributes []Attribute

An Attributes is a collection of attributes.

func ParseAttributes

func ParseAttributes(reader text.Reader) (Attributes, bool)

ParseAttributes parses attributes into a map. ParseAttributes returns a parsed attributes and true if could parse attributes, otherwise nil and false.

func (Attributes) Find

func (as Attributes) Find(name []byte) (interface{}, bool)

Find returns a (value, true) if an attribute correspond with given name is found, otherwise (nil, false).

type BlockParser

type BlockParser = gparser.BlockParser

func NewATXHeadingParser

func NewATXHeadingParser(opts ...HeadingOption) BlockParser

NewATXHeadingParser return a new BlockParser that can parse ATX headings.

type Config

type Config = gparser.Config

type Context

type Context = gparser.Context

type HeadingConfig

type HeadingConfig struct {
	AutoHeadingID bool
	Attribute     bool
}

A HeadingConfig struct is a data structure that holds configuration of the renderers related to headings.

func (*HeadingConfig) SetOption

func (b *HeadingConfig) SetOption(name OptionName, _ interface{})

SetOption implements SetOptioner.

type HeadingOption

type HeadingOption interface {
	Option
	SetHeadingOption(*HeadingConfig)
}

A HeadingOption interface sets options for heading parsers.

func WithAutoHeadingID

func WithAutoHeadingID() HeadingOption

WithAutoHeadingID is a functional option that enables custom heading ids and auto generated heading ids.

func WithHeadingAttribute

func WithHeadingAttribute() HeadingOption

WithHeadingAttribute is a functional option that enables custom heading attributes.

type InlineParser

type InlineParser = gparser.InlineParser

func NewCodeSpanParser

func NewCodeSpanParser() InlineParser

NewCodeSpanParser return a new InlineParser that parses inline codes surrounded by '`' with template action support.

func NewLinkParser

func NewLinkParser() InlineParser

NewLinkParser returns a new InlineParser that parses links with go template support.

type Option

type Option = gparser.Option

type OptionName

type OptionName = gparser.OptionName

type State

type State = gparser.State

Jump to

Keyboard shortcuts

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