frontmatter

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package frontmatter parses YAML frontmatter from markdown files, shared by skills and prompt templates. Port of Pi's utils/frontmatter.ts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[string]any

Map is a parsed frontmatter block. Absent frontmatter yields an empty Map rather than an error — a plain markdown file is valid input.

func Parse

func Parse(content []byte) (Map, string, error)

Parse splits a document into frontmatter and body.

Frontmatter must open with "---" on the first line and close with a line starting "\n---"; anything else is treated as an all-body document (frontmatter.ts:10-26). Line endings are normalized to \n first, so CRLF files parse identically.

func (Map) Bool

func (m Map) Bool(key string) (bool, bool)

Bool returns a bool-valued key.

func (Map) String

func (m Map) String(key string) (string, bool)

String returns a string-valued key.

Jump to

Keyboard shortcuts

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