Documentation
¶
Overview ¶
Package frontmatter parses YAML frontmatter blocks from markdown files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Doc ¶
type Doc struct {
// Frontmatter holds the YAML values from the document header.
Frontmatter map[string]any
// Value is what Pi's parseFrontmatter returns as `frontmatter`: the parsed header (`parsed ?? {}`), which is a mapping, or an array, string, number or boolean when the header is not a mapping. Frontmatter is the mapping, or empty.
Value any
// Body is the trimmed markdown content following the closing `---`.
Body string
// Err reports malformed YAML. The body remains available to callers that
// intentionally tolerate malformed frontmatter.
Err error
}
Doc is a parsed markdown-with-frontmatter file.
func Parse ¶
Parse extracts and parses a YAML frontmatter block plus body. If the file does not begin with a closed frontmatter block, the whole input is returned as Body and Frontmatter is empty.
func ParseOrdered ¶
ParseOrdered is Parse with Value built by yaml12.ParseOrdered: each object in it is a *yaml12.Object that lists its keys in insertion order, which is the order a JavaScript object enumerates them in (after its array-index keys). Frontmatter is the top-level mapping's map as in Parse.
Click to show internal directories.
Click to hide internal directories.