frontmatter

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(fm *Frontmatter) string

Build creates the YAML frontmatter string from a Frontmatter struct

func BuildContent

func BuildContent(fm *Frontmatter, bodyContent string) string

BuildContent combines frontmatter and body content into a complete document

func ExtractPathTags

func ExtractPathTags(noteType string) []string

ExtractPathTags generates tags from a note type path (e.g., "issues/bugs" -> ["issues", "bugs"])

func FormatTimestamp

func FormatTimestamp(t time.Time) string

FormatTimestamp formats a time.Time into the standard frontmatter timestamp format

func MergeTags

func MergeTags(sources ...[]string) []string

MergeTags combines multiple tag sources and removes duplicates

func ParseTimestamp

func ParseTimestamp(s string) (time.Time, error)

ParseTimestamp parses a frontmatter timestamp string into time.Time

Types

type Frontmatter

type Frontmatter struct {
	ID         string   `yaml:"id"`
	Title      string   `yaml:"title"`
	Type       string   `yaml:"type,omitempty"` // Note type (chat, interactive_agent, etc.)
	Aliases    []string `yaml:"aliases,flow"`
	Tags       []string `yaml:"tags,flow"`
	Repository string   `yaml:"repository,omitempty"`
	Branch     string   `yaml:"branch,omitempty"`
	Worktree   string   `yaml:"worktree,omitempty"`
	Created    string   `yaml:"created"`
	Modified   string   `yaml:"modified"`
	Started    string   `yaml:"started,omitempty"`  // For LLM notes
	PlanRef    string   `yaml:"plan_ref,omitempty"` // Reference to associated plan

	// Remote sync metadata
	Remote *RemoteMetadata `yaml:"remote,omitempty"`

	// Blog-specific fields
	Description string `yaml:"description,omitempty"`
	PublishDate string `yaml:"publishDate,omitempty"`
	UpdatedDate string `yaml:"updatedDate,omitempty"`
	Draft       bool   `yaml:"draft,omitempty"`
	Featured    bool   `yaml:"featured,omitempty"`
}

Frontmatter represents the structured metadata at the beginning of a note

func Parse

func Parse(content string) (*Frontmatter, string, error)

Parse extracts frontmatter from content and returns the parsed data and body

type RemoteMetadata

type RemoteMetadata struct {
	Provider  string   `yaml:"provider,omitempty"`
	ID        string   `yaml:"id,omitempty"`
	URL       string   `yaml:"url,omitempty"`
	State     string   `yaml:"state,omitempty"`
	UpdatedAt string   `yaml:"updated_at,omitempty"`
	Labels    []string `yaml:"labels,flow,omitempty"`
	Assignees []string `yaml:"assignees,flow,omitempty"`
	Milestone string   `yaml:"milestone,omitempty"`
}

RemoteMetadata represents sync metadata from remote sources (GitHub, etc.)

Jump to

Keyboard shortcuts

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