npm.io
5.0.0 • Published 9 months ago

hexo-front-matter

Licence
MIT
Version
5.0.0
Deps
2
Size
18 kB
Vulns
1
Weekly
0
Stars
23

hexo-front-matter

CI 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 are 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.

Option Description Default
mode The mode can be either json or yaml. yaml
separator Separator ---
prefixSeparator Add prefixing separator. false
split(str)

Splits a YAML front-matter string.

escape(str)

Converts hard tabs to soft tabs.

License

MIT

Keywords