hexo-front-matter
TypeScript icon, indicating that this package has built-in type declarations

4.2.1 • Public • Published

hexo-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 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

Dependencies (1)

Dev Dependencies (11)

Package Sidebar

Install

npm i hexo-front-matter

Weekly Downloads

19,278

Version

4.2.1

License

MIT

Unpacked Size

13.1 kB

Total Files

5

Last publish

Collaborators

  • ertrzyiks
  • abnerchou
  • tommy351
  • hexobot
  • jlhwung
  • tomap
  • curben
  • yoshinorin