remark-frontmatter-yaml
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

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.

Package Sidebar

Install

npm i remark-frontmatter-yaml

Weekly Downloads

24

Version

1.3.0

License

MIT

Unpacked Size

5.21 kB

Total Files

12

Last publish

Collaborators

  • babakfp