0.0.1 • Published 7 years ago
@yuheiy/html-frontmatter v0.0.1
html-frontmatter
Parse front-matter from raw HTML.
Installation
npm install @yuheiy/html-frontmatterUsage
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
0.0.1
7 years ago