# front-matter-html

> Parse Front Matter from an HTML comment

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

## Install

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

## 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 | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Geoff Kimball |
| Maintainers | gakimball |
| Keywords | front-matter, html, comment, yaml |

## Links

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

## Dependencies (1)

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

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

> Parse Front Matter from an HTML comment

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

## Installation

```bash
npm install front-matter-html
```

## Usage

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

const html = `<!--
kittens: true
puppies: true
lizards: false
-->

<!doctype html>
<html>
  <!-- ... -->
</html>
`;

const content = fm(html);
```

## API

### fm(html)

Parse YAML Front Matter from an HTML comment at the top of an HTML document.

- **html** (String): input HTML.

Returns an object with these properties:

- **attributes** (Object): extracted YAML.
- **body** (String): HTML without Front Matter comment.
- **frontmatter** (String): original YAML string.

### fm.test(html)

Test if an HTML document contains a Front Matter block within `<!-- -->`.

Returns `true` or `false`.

## Local Development

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

## License

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

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