front-matter-pug
Parse Front Matter from a Pug comment
Installation
npm install front-matter-pug
Usage
const fm = ; const pug = `//- kittens: true puppies: true lizards: false --- !doctypehtml body`; const content = ;
API
fm(pug)
Parse YAML Front Matter from a comment at the top of a Pug/Jade document.
- pug (String): input Pug code.
Returns an object with these properties:
- attributes (Object): extracted YAML.
- body (String): Pug code without Front Matter comment.
- frontmatter (String): original YAML string.
fm.test(pug)
Test if a Pug/Jade document contains a Front Matter block within a block comment (//-
).
Returns true
or false
.
Local Development
git clone https://github.com/gakimball/front-matter-pugcd front-matter-pugnpm installnpm test
License
MIT © Geoff Kimball