frontmatter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrMissing reports content that does not start with a valid YAML frontmatter block.
	ErrMissing = errors.New("frontmatter: missing YAML frontmatter")
	// ErrUnterminated reports content whose opening delimiter has no matching closing delimiter.
	ErrUnterminated = errors.New("frontmatter: unterminated YAML frontmatter")
	// ErrBOM reports content that starts with a UTF-8 BOM before the YAML frontmatter delimiter.
	ErrBOM = errors.New("frontmatter: UTF-8 BOM before YAML frontmatter")
)

Functions

func Decode

func Decode(content []byte, decode func([]byte) error) (string, error)

Decode splits frontmatter and delegates metadata decoding to the supplied callback.

Types

type Parts

type Parts struct {
	Metadata []byte
	Body     string
}

Parts contains the parsed metadata bytes and normalized markdown body.

func Split

func Split(content []byte) (Parts, error)

Split normalizes line endings and separates YAML frontmatter from the body.

Jump to

Keyboard shortcuts

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