Documentation
¶
Overview ¶
Package render implements the build-time rendering pipeline: goldmark for Markdown (GFM, TOC, anchors, front matter, mermaid) and chroma for syntax highlighting. Relative links pointing at in-repo files are rewritten to /view/ paths at the AST level via an ASTTransformer — never by text replacement on rendered output. User HTML files are never parsed or modified (ADR-001).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CodeOptions ¶
CodeOptions controls code rendering without coupling render to internal/config.
type CodeResult ¶
CodeResult is a rendered code block plus metadata for templates.
func Code ¶
func Code(src []byte, filename string, opts CodeOptions) (CodeResult, error)
Code renders a source file as class-based Chroma HTML.
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
Markdown renders Markdown documents. It is safe to reuse concurrently.
func NewMarkdown ¶
func NewMarkdown() *Markdown
NewMarkdown assembles the reusable Markdown rendering pipelines.
func (*Markdown) Render ¶
func (m *Markdown) Render(src []byte, ref PageRef, opts MarkdownOptions) (MarkdownResult, error)
Render converts a Markdown document into HTML and extracts title, TOC, and front matter metadata.
type MarkdownOptions ¶
type MarkdownOptions struct {
TOC bool
TOCMinHeadings int
Anchors bool
Mermaid bool
FrontmatterTitle bool
}
MarkdownOptions controls Markdown rendering without coupling render to internal/config.
type MarkdownResult ¶
type MarkdownResult struct {
HTML template.HTML
Title string
TOC []TOCItem
HasMermaid bool
Meta map[string]any
}
MarkdownResult is the rendered Markdown body plus metadata collected while parsing.
type PageRef ¶
type PageRef struct {
Path string
// Resolve returns "view" for files with a browsing page, "mirror" for
// files that should link to the raw mirror layer, or "" for unknown paths.
Resolve func(target string) string
}
PageRef identifies the current source file and resolves in-repository links.