0.0.1 • Published 7 years ago

@yuheiy/html-frontmatter v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

html-frontmatter

Parse front-matter from raw HTML.

Installation

npm install @yuheiy/html-frontmatter

Usage

const parseFrontMatter = require('@yuheiy/html-frontmatter')

const frontMatter = parseFrontMatter(`<!--
title: Awesome article
authors:
  - sato
  - suzuki
  - takahashi
-->

<p>hello</p>
`)

console.log(frontMatter)
/*
{
  data: {
    title: 'Awesome article',
    authors: [
      'sato',
      'suzuki',
      'takahashi'
    ]
  },
  content: '<p>hello</p>\n'
}
*/

License

MIT