0.1.0 • Published 8 years ago

xecio-front-matter v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

xecio-front-matter

Build Status NPM version Coverage Status

Front-matter parser.

What is Front-matter?

Front-matter allows you to specify data at the top of a file. Here're two formats:

YAML front-matter

---
layout: false
title: "Hello world"
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

JSON front-matter

;;;
"layout": false,
"title": "Hello world"
;;;
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Prefixing separators are optional.

API

parse(str, options)

Parses front-matter.

stringify(obj, options)

Converts an object to a front-matter string.

OptionDescriptionDefault
modeThe mode can be either json or yaml.yaml
separatorSeparator---
prefixSeparatorAdd prefixing separator.false

split(str)

Splits a YAML front-matter string.

escape(str)

Converts hard tabs to soft tabs.

License

MIT