# front-matter-pug

> Parse Front Matter from a Pug comment

Latest version **1.0.0** (published 2017-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install front-matter-pug
pnpm add front-matter-pug
yarn add front-matter-pug
bun add front-matter-pug
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-05-19 |
| First published | 2017-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Geoff Kimball |
| Maintainers | gakimball |
| Keywords | front-matter, pug, comment, yaml |

## Links

- npm: https://www.npmjs.com/package/front-matter-pug
- Repository: https://github.com/gakimball/front-matter-pug
- Homepage: https://github.com/gakimball/front-matter-pug#readme
- Issues: https://github.com/gakimball/front-matter-pug/issues
- npm.io page: https://npm.io/package/front-matter-pug

## Dependencies (2)

- [front-matter](https://npm.io/package/front-matter.md) ^2.1.2
- [strip-indent](https://npm.io/package/strip-indent.md) ^2.0.0

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-05-19

## README

# front-matter-pug

> Parse Front Matter from a Pug comment

[![Travis](https://img.shields.io/travis/gakimball/front-matter-pug.svg?maxAge=2592000)](https://travis-ci.org/gakimball/front-matter-pug) [![npm](https://img.shields.io/npm/v/front-matter-pug.svg?maxAge=2592000)](https://www.npmjs.com/package/front-matter-pug)

## Installation

```bash
npm install front-matter-pug
```

## Usage

```js
const fm = require('front-matter-pug');

const pug = `//-
  kittens: true
  puppies: true
  lizards: false
  ---

!doctype
html
  body
`;

const content = fm(pug);
```

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

```bash
git clone https://github.com/gakimball/front-matter-pug
cd front-matter-pug
npm install
npm test
```

## License

MIT &copy; [Geoff Kimball](http://geoffkimball.com)

---
_Source: https://npm.io/package/front-matter-pug · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
