frontmatter

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFrontmatter

func ExtractFrontmatter(content []byte) ([]byte, []byte, error)

ExtractFrontmatter extracts the raw YAML frontmatter bytes from content It returns the raw frontmatter bytes, the remaining content bytes, and any error

func Parse

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

Parse parses YAML frontmatter from a markdown file It returns a map of frontmatter data, the remaining content, and any error

func ParseFromFile

func ParseFromFile(fs util.FileSystem, path string) (map[string]interface{}, string, error)

ParseFromFile reads a file and parses its frontmatter

func RenderYAML added in v0.0.4

func RenderYAML(v any) (string, error)

RenderYAML marshals v to YAML using a consistent goccy/go-yaml encoder configuration. It returns the YAML string without any surrounding frontmatter fences.

func Wrap added in v0.0.4

func Wrap(v any) (string, error)

Wrap renders the given struct/value to YAML (via RenderYAML) and wraps it with '---' fences, followed by two newlines, suitable for frontmatter headers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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