Documentation
¶
Overview ¶
Package document parses a markdown source file with YAML frontmatter into a Document value. The Document only carries the data parsed off disk; rendering lives in internal/render and theme resolution in internal/theme.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Default = Config{ MDoc: true, Theme: "", Title: "Untitled", Author: "Anonymous", Tags: []string{}, Page: Page{}, Data: map[string]any{}, }
Default is applied when a file has no frontmatter or its frontmatter does not opt in with `mdoc: true`.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
MDoc bool `yaml:"mdoc"`
Theme string `yaml:"theme"`
Title string `yaml:"title"`
Author string `yaml:"author"`
Tags []string `yaml:"tags"`
Page Page `yaml:"page"`
Data map[string]any `yaml:"data"`
}
Config is the YAML frontmatter shape.
type Document ¶
type Document struct {
Config Config
Body string
// Path is the absolute path to the source file.
Path string
// Dir is the absolute directory containing the source file. Relative
// references inside the document (images, includes) resolve from here.
Dir string
}
Document is a parsed markdown source file.
type Page ¶
Page mirrors the relevant parts of CSS @page. Both fields are passed through verbatim into the theme's @page rule, so anything CSS accepts (named sizes like "A4" / "Letter", explicit "210mm 297mm", "A4 landscape", the four-value margin shorthand, etc.) is valid. Themes provide the fallback when a field is empty.