# markdown-it-front-matter

> Plugin to process front matter container for markdown-it markdown parser

Latest version **0.2.4** (published 2024-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-front-matter
pnpm add markdown-it-front-matter
yarn add markdown-it-front-matter
bun add markdown-it-front-matter
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2024-04-04 |
| First published | 2016-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 61 |
| Author | ParkSB |
| Maintainers | craigdmckenna, parksb |
| Keywords | markdown-it-plugin, markdown-it, markdown, front-matter, front matter, frontmatter, meta, meta data, meta-data, metadata |

## Links

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

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.2.4 (latest) — 2024-04-04
- 0.2.3 — 2020-10-12
- 0.2.2 — 2020-10-12
- 0.2.1 — 2020-02-06
- 0.1.2 — 2016-05-07
- 0.1.1 — 2016-05-07

## README

# markdown-it-front-matter
 
[![npm](https://badge.fury.io/js/markdown-it-front-matter.svg)](https://badge.fury.io/js/markdown-it-front-matter)
[![master-ci](https://github.com/ParkSB/markdown-it-front-matter/workflows/master-ci/badge.svg)](https://github.com/ParkSB/markdown-it-front-matter/actions?query=workflow%3Amaster-ci)

> Plugin for processing front matter for markdown-it markdown parser.

## Install

```sh
$ npm install markdown-it-front-matter --save
```

## Valid Front Matter

Essentially, valid front matter is a fenced block:

* Indicated by **three** or **more** dashes: `---`
* Opening and closing fences must be the same number of *dash* characters
* Opening fence must begin on the first line of the markdown string/file
* Opening fence must not be indented

```yaml
---
valid-front-matter: true
---
```

> The example above uses YAML but YAML is not required

> (bring your own front matter parser)


## Example

* Front Matter is not rendered.
* Any markup inside the block is passed to the **required** callback function.

```javascript
const md = require('markdown-it')()
  .use(require('markdown-it-front-matter'), function(fm) {
    console.log(fm)
  });

let result = md.render('---\ntitle: This is the Title\n---\n# Heading\n----\nsome text');

// > title: This is the Title
```

## References / Thanks

Code heavily borrowed from [markdown-it-container](https://github.com/markdown-it/markdown-it-container)

* Alex Kocharin [github/rlidwka](https://github.com/rlidwka)
* Vitaly Puzrin [github/puzrin](https://github.com/puzrin)

## License

_markdown-it-front-matter_ is distributed under the MIT License - see the [LICENSE](LICENSE) file for details.

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