https://github.com/babakfp/remark-frontmatter-yaml
A remark plugin to parse the YAML frontmatter.
https://github.com/babakfp/remark-frontmatter-yaml
frontmatter remark yaml
Last synced: about 2 months ago
JSON representation
A remark plugin to parse the YAML frontmatter.
- Host: GitHub
- URL: https://github.com/babakfp/remark-frontmatter-yaml
- Owner: babakfp
- Created: 2024-03-19T01:15:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-30T14:51:23.000Z (almost 2 years ago)
- Last Synced: 2025-09-17T04:45:20.538Z (9 months ago)
- Topics: frontmatter, remark, yaml
- Language: TypeScript
- Homepage: https://npmjs.com/package/remark-frontmatter-yaml
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Remark Frontmatter YAML
A [remark](https://github.com/remarkjs/remark) plugin to parse the [YAML](https://yaml.org) frontmatter.
## What is this?
This package is a [[unified](https://github.com/unifiedjs/unified)] ([remark](https://github.com/remarkjs/remark)) plugin to parse YAML frontmatter.
```yaml
message: Hello, World!
```
## When should I use this?
This plugin is made to be used with [Remark Frontmatter](https://www.npmjs.com/package/remark-frontmatter).
## Example
```ts
import { unified } from "unified"
import remarkParse from "remark-parse"
import remarkStringify from "remark-stringify"
import remarkFrontmatter from "remark-frontmatter"
import remarkFrontmatterYaml from "remark-frontmatter-yaml"
const file = await unified()
.use(remarkParse)
.use(remarkStringify)
.use(remarkFrontmatter)
.use(remarkFrontmatterYaml)
.process(/* content */)
console.log(file.data.frontmatter) // { message: "Hello, World!" }
```
## API
### `options`
#### `name`
- Type: `string`
- Default `"frontmatter"`
The name that is going to be used instead of `frontmatter` in `file.data.frontmatter`.
#### `yaml`
- Type: `Parameters[2]`
- Default `undefined`
Options that are directly passed to the YAML parser.