All Projects → gernest → front

gernest / front

Licence: MIT license
extracts frontmatter from text files with ease with golang.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to front

polyglot-jekyll
Plugin-free multilanguage Jekyll websites
Stars: ✭ 46 (-16.36%)
Mutual labels:  frontmatter
front matter parser
Ruby library to parse files or strings with a front matter. It has automatic syntax detection.
Stars: ✭ 62 (+12.73%)
Mutual labels:  frontmatter
jekyll frontmatter tests
A Jekyll plugin to test frontmatter on posts and other documents in a Jekyll site.
Stars: ✭ 28 (-49.09%)
Mutual labels:  frontmatter
remark-frontmatter
remark plugin to support frontmatter (YAML, TOML, and more)
Stars: ✭ 167 (+203.64%)
Mutual labels:  frontmatter
Gray Matter
Contributing Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Stars: ✭ 2,105 (+3727.27%)
Mutual labels:  frontmatter
medium-2-md
A CLI tool that converts exported Medium posts (html) to Jekyll/Hugo compatible markdown with front matter.
Stars: ✭ 113 (+105.45%)
Mutual labels:  frontmatter
contentz
Create Content, Get a Highly Optimized Website
Stars: ✭ 57 (+3.64%)
Mutual labels:  frontmatter
front
Frontmatter
Stars: ✭ 21 (-61.82%)
Mutual labels:  frontmatter

front Build Status GoDocCoverage Status

extracts frontmatter from text files with ease.

Features

  • Custom delimiters. You are free to register any delimiter of your choice. Provided its a three character string. e.g +++, $$$, ---, %%%
  • Custom Handlers. Anything that implements HandlerFunc can be used to decode the values from the frontmatter text, you can see the JSONHandler for how to implement one.
  • Support YAML frontmatter
  • Support JSON frontmatter.

Installation

go get github.com/gernest/front

How to use

package main

import (
	"fmt"
	"strings"

	"github.com/gernest/front"
)

var txt = `+++
{
    "title":"front"
}
+++

# Body
Over my dead body
`

func main() {
	m := front.NewMatter()
	m.Handle("+++", front.JSONHandler)
	f, body, err := m.Parse(strings.NewReader(txt))
	if err != nil {
		panic(err)
	}

	fmt.Printf("The front matter is:\n%#v\n", f)
	fmt.Printf("The body is:\n%q\n", body)
}

Please see the tests formore details

Licence

This project is under the MIT Licence. See the LICENCE file for the full license text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].