templates

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builtins added in v0.2.0

func Builtins() map[string]Template

Builtins returns the templates embedded in the binary, keyed by name.

func Headings added in v0.2.0

func Headings(body string) []string

Headings extracts the markdown heading lines (## and deeper) from a body.

func Load added in v0.2.0

func Load(customDir string) (map[string]Template, error)

Load returns the built-in templates merged with any custom `*.tpl` found in customDir (whose names override built-ins). A missing customDir is ignored.

func Names added in v0.2.0

func Names(templates map[string]Template) []string

Names returns the template names sorted alphabetically.

func RenderRecord added in v0.2.0

func RenderRecord(header, body string) (string, error)

RenderRecord wraps a body with the record envelope (front-matter + body).

func Validate added in v0.2.0

func Validate(templateBody, providedBody string) error

Validate checks that providedBody contains every heading of the template body, in the same order, each followed by some non-blank content.

Types

type Template added in v0.2.0

type Template struct {
	Name    string
	Body    string
	Builtin bool
}

Template is a named ADR body skeleton (the section headings + their guidance).

Jump to

Keyboard shortcuts

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