Documentation
¶
Overview ¶
Package template provides template processing and ID generation for notes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateID ¶
GenerateID creates a deterministic note ID from the note file path and type. The ID is formed as "<type>-<slug>" where slug is the lowercase, hyphenated base filename (without the .md extension).
Types ¶
type ProcessConfig ¶
type ProcessConfig struct {
VaultPath string // absolute path to vault root (for metadata)
Path string // vault-relative path of the new note
Type string // note type (e.g. "project", "decision")
Fields map[string]string // field overrides (includes optional "title", "id", …)
Body string // explicit body override; empty means use template body
TemplatePath string // absolute path to the template file
RequiredFields []string // type-specific required fields (for minimal fallback)
}
ProcessConfig holds all inputs needed to process a note template.
type ProcessResult ¶
type ProcessResult struct {
Content []byte // serialized YAML-frontmatter + body
ID string // final note ID
Path string // echoes ProcessConfig.Path
Warnings []string // non-fatal issues (e.g. unknown template vars, missing template)
FinalFrontmatter map[string]interface{} // the final frontmatter map after all substitutions and overrides
}
ProcessResult is the output of a successful Process call.
func Process ¶
func Process(cfg ProcessConfig) (*ProcessResult, error)
Process executes the full note-creation pipeline:
- Load template from disk (fallback to minimal note if missing)
- Build variable map and substitute placeholders
- Parse frontmatter
- Apply field overrides from cfg.Fields
- Ensure core fields (id, type) are present and a `created` stamp is set — see schema/registry.go for the field taxonomy.
- Override body if cfg.Body is set
- Serialize and return
Click to show internal directories.
Click to hide internal directories.