fmatter

package module
v0.0.0-...-5145a14 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 6 Imported by: 5

README

fmatter

A simple YAML Front Matter parser, using the gopkg.in/yaml.v2 package. View the godoc documentation here.

Documentation

Overview

Package fmatter is a simple YAML Front Matter parser, using the gopkg.in/yaml.v2 package.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(data []byte, frontmatter interface{}) (content []byte, err error)

Read detects and parses the front matter data, and returns the remaining contents. If no front matter is found, the entire file contents are returned. For details on the frontmatter parameter, please see the gopkg.in/yaml.v2 package.

Example
data := []byte(`---
title: Some Title
---
content`)

var frontmatter struct{ Title string }
content, _ := Read(data, &frontmatter)
fmt.Println(content)

func ReadFile

func ReadFile(filename string, frontmatter interface{}) (content []byte, err error)

ReadFile read an entire file into memory, and calls Read which parses the front matter data and returns the remaining file contents.

Types

This section is empty.

Jump to

Keyboard shortcuts

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