Avatar Ilya Mateyko

This package is unmaintained.

package frontmatter

import "go.astrophena.name/gen/frontmatter"

Package frontmatter implements frontmatter-related functions.

Index

Variables

var ErrNotDetected = errors.New("no frontmatter detected")

ErrNotDetected is returned when no frontmatter has been detected.

Functions

func Contains

func Contains(text string) (contains bool, err error)

Contains returns true if the supplied text includes frontmatter.

func Extract

func Extract(text string) (frontmatter, content string, err error)

Extract extracts frontmatter from supplied text, returning frontmatter and content.

func Parse

func Parse(text string, obj interface{}) (content string, err error)

Parse extracts frontmatter from supplied text and unmarshals it into obj, returning content without frontmatter and an error.