Help us shape the future of Go! Take the 2026 Go Developer Survey

model

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doc

type Doc struct {
	Path     string
	Type     string
	Title    string
	Fields   map[string]Value
	Tags     []string
	Headings []Heading
	Paths    []string
	Body     string
	FMStart  int
	FMEnd    int
	CRLF     bool
	Warnings []string
}

Doc is one markdown file held in memory.

func (Doc) Field

func (d Doc) Field(name string) (Value, bool)

Field looks up a frontmatter value by key.

type Heading

type Heading struct {
	Level int
	Text  string
}

Heading is one markdown heading found in a document body.

type Kind

type Kind uint8

Kind discriminates the concrete type a Value holds.

const (
	KindNull Kind = iota
	KindString
	KindNumber
	KindBool
	KindDate
	KindList
)

type Value

type Value struct {
	Kind Kind
	Str  string
	Num  float64
}

Value is a single frontmatter value with its parsed kind. Lists are stored JSON-encoded in Str. Dates are stored as YYYY-MM-DD in Str.

func (Value) IsZero

func (v Value) IsZero() bool

IsZero reports whether the value is null or empty.

func (Value) Len

func (v Value) Len() int

Len returns element count for lists and rune count for strings. Other kinds return 0.

func (Value) List

func (v Value) List() []string

List returns the decoded elements of a KindList value, nil for other kinds.

func (Value) String

func (v Value) String() string

String renders the value for display. Lists join with ", ".

Jump to

Keyboard shortcuts

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