Project: landakram/remark-parse-yaml

Package: remark-parse-yaml@0.0.3

  1. Dependents: 0
  2. Parses yaml blocks into structured data
  1. remark 214
  2. markdown 154
  3. remark-plugin 82
  4. gfm 21


npm version Build Status

This remark plugin takes markdown with yaml frontmatter and parses the yaml into an object.


const unified = require('unified')
const markdown = require('remark-parse')
const frontmatter = require('remark-frontmatter')
const parseFrontmatter = require('remark-parse-yaml');

let processor = unified()

When the processor is run, yaml nodes will now have an additional key, parsedValue, attached to its data key.

Say that we have this markdown string:

metadata: this is metadata
    - one
    - two

# Heading 

When parsed, this will produce a yaml node with a data object that looks like this:

data: {
    parsedValue: {
        metadata: "this is metadata",
        tags: ["one", "two"]