Documentation
¶
Overview ¶
Package markdown provides markdown parsing, transformation, and rendering capabilities for nanodoc. It supports header level adjustment, TOC generation, and file header insertion to enable rich markdown output formatting.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeaderFormatter ¶
type HeaderFormatter struct{}
HeaderFormatter formats file headers according to nanodoc options
func NewHeaderFormatter ¶
func NewHeaderFormatter() *HeaderFormatter
NewHeaderFormatter creates a new header formatter
func (*HeaderFormatter) FormatFileHeader ¶
func (hf *HeaderFormatter) FormatFileHeader(filename string, sequence string, level int) string
FormatFileHeader creates a formatted header for a file
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser wraps goldmark parser functionality
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer converts markdown AST back to markdown text
type TOCGenerator ¶
type TOCGenerator struct{}
TOCGenerator extracts and generates table of contents
func NewTOCGenerator ¶
func NewTOCGenerator() *TOCGenerator
NewTOCGenerator creates a new TOC generator
func (*TOCGenerator) ExtractTOC ¶
func (tg *TOCGenerator) ExtractTOC(doc *Document) []TOCEntry
ExtractTOC extracts all headers from the document for TOC generation
func (*TOCGenerator) GenerateTOCMarkdown ¶
func (tg *TOCGenerator) GenerateTOCMarkdown(entries []TOCEntry) string
GenerateTOCMarkdown creates a markdown formatted table of contents
type Transformer ¶
type Transformer struct{}
Transformer provides methods to modify markdown AST
func NewTransformer ¶
func NewTransformer() *Transformer
NewTransformer creates a new markdown transformer
func (*Transformer) AdjustHeaderLevels ¶
func (t *Transformer) AdjustHeaderLevels(doc *Document, increment int) error
AdjustHeaderLevels increases all header levels by the specified amount
func (*Transformer) HasH1 ¶
func (t *Transformer) HasH1(doc *Document) bool
HasH1 checks if the document contains any H1 headers
func (*Transformer) InsertFileHeader ¶
func (t *Transformer) InsertFileHeader(doc *Document, headerText string, level int) error
InsertFileHeader adds a header at the beginning of the document