Documentation
¶
Overview ¶
Package doc parses YAML frontmatter and represents the indexable document model that all downstream layers consume.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Split ¶
Split extracts the YAML frontmatter block from a file body. The frontmatter must start at the very first byte with `---\n` and end with a line that is exactly `---`. When no frontmatter is detected (or the closing delimiter is missing), the returned frontmatter is nil and body equals the input content. A YAML parse error is returned as-is so callers can decide whether to fail the index or fall back to a raw body.
Types ¶
type Doc ¶
type Doc struct {
Path string // repo-relative, forward slashes
Title string // frontmatter.title -> first H1 -> filename
Tags []string // frontmatter.tags, normalized (lowercase, trimmed)
Body string // file body sans frontmatter (or full file if no frontmatter)
Frontmatter map[string]any // raw frontmatter (nil when absent)
ModTime time.Time // filled by sync
Size int64 // filled by sync
Digest string // git-blob SHA, filled by sync
}
Doc is the indexable representation of a single file.
func FromBytes ¶
FromBytes builds a Doc from file contents. path is the repo-relative forward-slash path used both as the doc ID and as the fallback for title derivation.