frontmatter

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package frontmatter parses simple metadata blocks from text files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgumentList

func ArgumentList(value any) []string

ArgumentList converts a frontmatter value into shell-like argument tokens.

func Bool

func Bool(value any) (bool, bool)

Bool parses common frontmatter boolean representations and reports whether parsing was successful.

func CompactStrings

func CompactStrings(values []string) []string

CompactStrings trims values and removes empties and duplicates while preserving first-seen order.

func DescriptionFromMarkdown

func DescriptionFromMarkdown(body string) string

DescriptionFromMarkdown returns the first non-empty markdown line with leading heading markers removed.

func FirstString

func FirstString(values map[string]any, keys ...string) string

FirstString returns the first non-empty scalar string from keys.

func NormalizePaths

func NormalizePaths(values []string) []string

NormalizePaths normalizes slash style, removes trailing glob suffixes, and compacts the result.

func Parse

func Parse(text string) (string, map[string]any, error)

Parse extracts a leading YAML frontmatter block and returns the body and parsed values. Text without a complete frontmatter block is returned unchanged with nil values.

func ScalarString

func ScalarString(value any) string

ScalarString converts a scalar frontmatter value to a string.

func String

func String(values map[string]any, key string) string

String returns a trimmed scalar string for key.

func StringList

func StringList(value any) []string

StringList converts strings or YAML lists into a compact list split on commas and newlines.

Types

This section is empty.

Jump to

Keyboard shortcuts

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