remark-frontmatter-yaml
v1.3.0
Published
A remark plugin to parse the YAML frontmatter.
Downloads
43
Maintainers
Readme
Remark Frontmatter YAML
A remark plugin to parse the YAML frontmatter.
What is this?
This package is a [unified] (remark) plugin to parse YAML frontmatter.
message: Hello, World!
When should I use this?
This plugin is made to be used with Remark Frontmatter.
Example
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<typeof yaml.parse>[2]
- Default
undefined
Options that are directly passed to the YAML parser.