Package Exports
- remark-parse-yaml
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-parse-yaml) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
remark-parse-yaml
This remark plugin takes markdown with yaml frontmatter and parses the yaml into an object.
Usage
const unified = require('unified')
const markdown = require('remark-parse')
const frontmatter = require('remark-frontmatter')
const parseFrontmatter = require('remark-parse-yaml');
let processor = unified()
.use(markdown)
.use(frontmatter)
.use(parseFrontmatter)
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
tags:
- 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"]
}
}