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

0.0.3 • 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.

fence

  • Type: { open: string; close: string }
  • Default { open: "---", close: "---" }

The syntax that is used to wrap the content of frontmatter.

Must be the same syntax that is used in Remark Frontmatter

strip

  • Type: boolean
  • Default true

Set to false to prevent removal of the frontmatter content.

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

14

Version

0.0.3

License

MIT

Unpacked Size

7.82 kB

Total Files

14

Last publish

Collaborators

  • babakfp