frontmatter

package
v0.0.0-...-7635d6e Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package frontmatter provides a parser for page metadata stored in markdown code blocks.

Index

Constants

View Source
const Fence = "```"

Fence delimits front-matter blocks.

View Source
const SimpleDateLayout = "2006-01-02"

SimpleDateLayout is the time.Time layout used for SimpleDate typed dates that omit a timestamp.

Variables

View Source
var ErrBadFrontMatter = fmt.Errorf("bad front-matter")

ErrBadFrontMatter indicates that the front-matter is incomplete or not decodeable.

View Source
var ErrNoFrontMatter = fmt.Errorf("no front-matter")

ErrNoFrontMatter indicates that the content began without a front-matter.

View Source
var ErrUnsupportedFormat = fmt.Errorf("unsupported format")

ErrUnsupportedFormat indicates that the front-matter uses an unsupported format.

Functions

func Read

func Read(ctx context.Context, r io.Reader, dest interface{}) error

Read parses a front-matter from the given reader and stores the decoded data into dest. Parsing is stopped after the closing limiter of the front-matter has been read leaving the given reader reusable, e.g. to read the following content.

Types

type SimpleDate

type SimpleDate time.Time

SimpleDate is a basic date format omitting a timestamp.

func NewSimpleDate

func NewSimpleDate(year, month, day int) *SimpleDate

NewSimpleDate returns a SimpleDate for the given date values.

func (*SimpleDate) MarshalJSON

func (s *SimpleDate) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*SimpleDate) String

func (s *SimpleDate) String() string

func (*SimpleDate) UnmarshalJSON

func (s *SimpleDate) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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