remark-parse-yaml
This remark plugin takes markdown with yaml frontmatter and parses the yaml into an object.
Usage
const unified = const markdown = const frontmatter = const parseFrontmatter = ; let processor =
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 metadatatags:- 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"