fmatter

package module
v0.0.0-...-377c8ea Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2015 License: MIT Imports: 6 Imported by: 2

README

fmatter

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

Installation

go get j4k.co/fmatter

New to Go? Have a look at how import paths work.

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)
Output:

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.

Directories

Path Synopsis
Package fmatter is a TOML Front Matter parser, using the github.com/BurntSushi/toml package.
Package fmatter is a TOML Front Matter parser, using the github.com/BurntSushi/toml package.

Jump to

Keyboard shortcuts

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