Documentation
¶
Overview ¶
Package parser provides markdown parsing functionality and Abstract Syntax Tree definitions.
Index ¶
Constants ¶
const (
// StrongEmphasisLevel defines the level for strong emphasis (**)
StrongEmphasisLevel = 2
)
Constants
Variables ¶
This section is empty.
Functions ¶
func DebugString ¶
DebugString returns a debug representation of a document
func NodeTypeString ¶
NodeTypeString returns a string representation of the node type
Types ¶
type BasicParser ¶
type BasicParser struct{}
BasicParser represents a simple placeholder parser (for testing)
func (*BasicParser) Parse ¶
func (p *BasicParser) Parse(content []byte) (*Document, error)
Parse implements a basic placeholder parser
func (*BasicParser) Validate ¶
func (p *BasicParser) Validate() error
Validate validates the parser configuration
type Document ¶
type Document struct {
Children []Node
}
Document represents the root document node
func (*Document) GetAllNodes ¶
GetAllNodes returns all nodes in the document as a flat slice.
type GoldmarkParser ¶
type GoldmarkParser struct {
// contains filtered or unexported fields
}
GoldmarkParser implements the Parser interface using goldmark
func NewGoldmarkParser ¶
func NewGoldmarkParser() *GoldmarkParser
NewGoldmarkParser creates a new goldmark-based parser
func (*GoldmarkParser) Parse ¶
func (p *GoldmarkParser) Parse(content []byte) (*Document, error)
Parse parses the given markdown content and returns an AST
func (*GoldmarkParser) Validate ¶
func (p *GoldmarkParser) Validate() error
Validate checks if the parser is properly configured
type ListItem ¶
type ListItem struct {
Text string
Marker string
Children []Node // Support for nested lists and other elements
}
ListItem represents a list item node
type Node ¶
Node represents a basic node in the markdown AST
func FindFirstNode ¶
FindFirstNode finds the first node of a specific type
type NodeType ¶
type NodeType int
NodeType represents the type of a node in the AST
const ( // NodeDocument represents a document node containing the entire markdown structure NodeDocument NodeType = iota // NodeHeading represents a heading node (# Title) NodeHeading // NodeParagraph represents a paragraph of text NodeParagraph // NodeList represents an ordered or unordered list NodeList // NodeListItem represents a single item within a list NodeListItem // NodeCodeBlock represents a code block (fenced or indented) NodeCodeBlock // NodeText represents plain text content NodeText )
NodeType constants
type Parser ¶
Parser interface defines methods for parsing Markdown content and validating the parser
func DefaultParser ¶
func DefaultParser() Parser
DefaultParser returns the default parser implementation using the Goldmark parser