frontmatter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Delimiter               = "---"
	NoFrontmatterError      = "note does not contain frontmatter"
	InvalidFrontmatterError = "frontmatter contains invalid YAML"
)

Variables

This section is empty.

Functions

func DeleteKey

func DeleteKey(content, key string) (string, error)

DeleteKey removes a key from the frontmatter, returning the full updated content.

func Format

func Format(fm map[string]interface{}) (string, error)

Format converts a frontmatter map to a YAML string.

func HasFrontmatter

func HasFrontmatter(content string) bool

HasFrontmatter checks if content starts with frontmatter delimiters.

func Parse

func Parse(content string) (map[string]interface{}, string, error)

Parse extracts and parses frontmatter from note content. Returns the frontmatter as a map, the body content, and any error.

func SetKey

func SetKey(content, key, value string) (string, error)

SetKey updates or adds a key in the frontmatter, returning the full updated content. If no frontmatter exists, it creates new frontmatter with the key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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