parser

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdmonitionKind = ast.NewNodeKind("Admonition")

AdmonitionKind represents the type of admonition

Functions

func NewAdmonitionExtension

func NewAdmonitionExtension() goldmark.Extender

NewAdmonitionExtension returns a new AdmonitionExtension

func NewAdmonitionHTMLRenderer

func NewAdmonitionHTMLRenderer(opts ...html.Option) renderer.NodeRenderer

NewAdmonitionHTMLRenderer returns a new admonition HTML renderer

func NewAdmonitionParser

func NewAdmonitionParser() parser.BlockParser

NewAdmonitionParser returns a new admonition parser

func TransformExternalLinks(doc ast.Node)

TransformExternalLinks adds target="_blank" and rel="noopener noreferrer" to external links

func TransformMarkdownLinks(doc ast.Node, currentPagePath string, basePath string)

TransformMarkdownLinks walks the AST and converts relative .md links to .html It applies slug transformation logic to match the navigation URL structure basePath is prepended to all transformed links (e.g., "/docs")

Types

type Admonition

type Admonition struct {
	ast.BaseBlock
	AdmonType string
	Title     string
}

Admonition is a custom block node for admonitions (:::info, :::warning, etc.)

func (*Admonition) Dump

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

Dump implements ast.Node.Dump

func (*Admonition) Kind

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

Kind implements ast.Node.Kind

type AdmonitionExtension

type AdmonitionExtension struct{}

AdmonitionExtension is a Goldmark extension for admonitions

func (*AdmonitionExtension) Extend

func (e *AdmonitionExtension) Extend(m goldmark.Markdown)

Extend implements goldmark.Extender

type ChangelogParser

type ChangelogParser struct {
	// contains filtered or unexported fields
}

ChangelogParser handles parsing of changelog content

func NewChangelogParser

func NewChangelogParser() *ChangelogParser

NewChangelogParser creates a new changelog parser

func (*ChangelogParser) ParseChangelogDir

func (p *ChangelogParser) ParseChangelogDir(changelogDir string) (*core.ChangelogPage, error)

ParseChangelogDir parses all changelog content from a directory

func (*ChangelogParser) ParseConfig

func (p *ChangelogParser) ParseConfig(path string) (core.ChangelogConfig, error)

ParseConfig parses the changelog config.yaml file

func (*ChangelogParser) ParseRelease

func (p *ChangelogParser) ParseRelease(path string) (core.Release, error)

ParseRelease parses a single release markdown file

func (*ChangelogParser) ParseReleases

func (p *ChangelogParser) ParseReleases(dir string) ([]core.Release, error)

ParseReleases parses all release markdown files in a directory

type FrontmatterParser

type FrontmatterParser struct{}

FrontmatterParser handles extraction of YAML frontmatter from markdown

func NewFrontmatterParser

func NewFrontmatterParser() *FrontmatterParser

NewFrontmatterParser creates a new frontmatter parser

func (*FrontmatterParser) Parse

func (p *FrontmatterParser) Parse(content []byte) (core.Metadata, []byte, error)

Parse extracts frontmatter from markdown content Returns the metadata and the remaining markdown content (without frontmatter)

func (*FrontmatterParser) ParseFile

func (p *FrontmatterParser) ParseFile(path string) (core.Metadata, []byte, error)

ParseFile reads and parses a markdown file

type IncidentFrontmatter

type IncidentFrontmatter struct {
	ID                 string                `yaml:"id"`
	Title              string                `yaml:"title"`
	Status             core.IncidentStatus   `yaml:"status"`
	Severity           core.IncidentSeverity `yaml:"severity"`
	AffectedComponents []string              `yaml:"affected_components"`
	CreatedAt          time.Time             `yaml:"created_at"`
	UpdatedAt          time.Time             `yaml:"updated_at"`
	ResolvedAt         *time.Time            `yaml:"resolved_at"`
}

IncidentFrontmatter represents the YAML frontmatter for incidents

type MCPParser added in v1.5.0

type MCPParser struct{}

MCPParser handles parsing of MCP server manifest files

func NewMCPParser added in v1.5.0

func NewMCPParser() *MCPParser

NewMCPParser creates a new MCP parser

func (*MCPParser) ParseFile added in v1.5.0

func (p *MCPParser) ParseFile(filePath string) (*core.MCPSpec, error)

ParseFile parses an MCP server manifest JSON file into an MCPSpec

type MaintenanceFrontmatter

type MaintenanceFrontmatter struct {
	ID                 string                 `yaml:"id"`
	Title              string                 `yaml:"title"`
	Description        string                 `yaml:"description"`
	AffectedComponents []string               `yaml:"affected_components"`
	ScheduledStart     time.Time              `yaml:"scheduled_start"`
	ScheduledEnd       time.Time              `yaml:"scheduled_end"`
	Status             core.MaintenanceStatus `yaml:"status"`
}

MaintenanceFrontmatter represents the YAML frontmatter for maintenance

type MarkdownParser

type MarkdownParser struct {
	// contains filtered or unexported fields
}

MarkdownParser handles markdown to HTML conversion

func NewMarkdownParser

func NewMarkdownParser() *MarkdownParser

NewMarkdownParser creates a new markdown parser with recommended extensions

func (*MarkdownParser) Parse

func (p *MarkdownParser) Parse(content []byte) ([]byte, error)

Parse converts markdown content to HTML

func (*MarkdownParser) ParseWithContext

func (p *MarkdownParser) ParseWithContext(content []byte, currentPagePath string, basePath string) ([]byte, error)

ParseWithContext converts markdown content to HTML with link transformation currentPagePath is the relative path from docs root (e.g., "api/getting-started.md") basePath is the base path to prepend to all links (e.g., "/docs")

type OpenAPIParser

type OpenAPIParser struct {
	// contains filtered or unexported fields
}

OpenAPIParser handles parsing of OpenAPI specifications

func NewOpenAPIParser

func NewOpenAPIParser(cacheDir string) *OpenAPIParser

NewOpenAPIParser creates a new OpenAPI parser

func (*OpenAPIParser) NameFromURL

func (p *OpenAPIParser) NameFromURL(url string) string

NameFromURL extracts a filename from a URL

func (*OpenAPIParser) ParseFile

func (p *OpenAPIParser) ParseFile(filePath string) (*core.APISpec, error)

ParseFile parses an OpenAPI spec from a local file

func (*OpenAPIParser) ParseURL

func (p *OpenAPIParser) ParseURL(url string) (*core.APISpec, error)

ParseURL fetches and parses an OpenAPI spec from a URL

type ReleaseFrontmatter

type ReleaseFrontmatter struct {
	Version    string    `yaml:"version"`
	Date       time.Time `yaml:"date"`
	Title      string    `yaml:"title"`
	Prerelease bool      `yaml:"prerelease"`
}

ReleaseFrontmatter represents the YAML frontmatter for releases

type StatusParser

type StatusParser struct {
	// contains filtered or unexported fields
}

StatusParser handles parsing of status page content

func NewStatusParser

func NewStatusParser() *StatusParser

NewStatusParser creates a new status parser

func (*StatusParser) ParseComponents

func (p *StatusParser) ParseComponents(path string) ([]core.StatusComponent, error)

ParseComponents parses the components.yaml file

func (*StatusParser) ParseConfig

func (p *StatusParser) ParseConfig(path string) (core.StatusConfig, error)

ParseConfig parses the status config.yaml file

func (*StatusParser) ParseIncident

func (p *StatusParser) ParseIncident(path string) (core.Incident, error)

ParseIncident parses a single incident markdown file

func (*StatusParser) ParseIncidents

func (p *StatusParser) ParseIncidents(dir string) ([]core.Incident, error)

ParseIncidents parses all incident markdown files in a directory

func (*StatusParser) ParseMaintenance

func (p *StatusParser) ParseMaintenance(dir string) ([]core.Maintenance, error)

ParseMaintenance parses all maintenance markdown files in a directory

func (*StatusParser) ParseMaintenanceFile

func (p *StatusParser) ParseMaintenanceFile(path string) (core.Maintenance, error)

ParseMaintenanceFile parses a single maintenance markdown file

func (*StatusParser) ParseStatusDir

func (p *StatusParser) ParseStatusDir(statusDir string) (*core.StatusPage, error)

ParseStatusDir parses all status content from a directory

type TOCEntry

type TOCEntry struct {
	Title      string
	FilePath   string
	Level      int
	IsExternal bool
	Children   []*TOCEntry
}

TOCEntry represents an entry in the TOC.md file

type TOCFileParser

type TOCFileParser struct {
	// contains filtered or unexported fields
}

TOCFileParser parses a TOC.md file to extract navigation structure

func NewTOCFileParser

func NewTOCFileParser(docsDir string) *TOCFileParser

NewTOCFileParser creates a new TOC file parser

func (*TOCFileParser) Flatten

func (p *TOCFileParser) Flatten(entries []*TOCEntry) []string

Flatten returns a flat list of all file paths in order

func (*TOCFileParser) Parse

func (p *TOCFileParser) Parse(tocFilePath string) ([]*TOCEntry, error)

Parse parses a TOC.md file and returns the navigation structure

type TOCParser

type TOCParser struct {
	// contains filtered or unexported fields
}

TOCParser generates table of contents from markdown

func NewTOCParser

func NewTOCParser() *TOCParser

NewTOCParser creates a new TOC parser

func (*TOCParser) Parse

func (p *TOCParser) Parse(content []byte) (*core.TOC, error)

Parse generates a table of contents from markdown content

Jump to

Keyboard shortcuts

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