unified

Project: remarkjs/remark-yaml-config

Package: remark-yaml-config@5.0.0

  1. Dependencies: 0·Dependents: 27
  2. remark plugin to configure it with YAML frontmatter
  1. remark 201
  2. unified 170
  3. markdown 141
  4. plugin 131
  5. mdast 90
  6. remark-plugin 79
  7. yaml 6
  8. frontmatter 6
  9. options 2
  10. config 2
  11. settings 2

remark-yaml-config

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to configure it with YAML frontmatter. This requires remark-frontmatter as well.

Important!

This plugin is affected by the new parser in remark (micromark, see remarkjs/remark#536). Use version 4 while you’re still on remark 12. Use version 5 for remark 13+.

Install

npm:

npm install remark-yaml-config

Use

Say we have the following file, example.md:

---
remark:
  bullet: "*"
---

-   Hello

And our script, example.js, looks as follows:

var vfile = require('to-vfile')
var remark = require('remark')
var frontmatter = require('remark-frontmatter')
var yamlConfig = require('remark-yaml-config')

remark()
  .use(frontmatter)
  .use(yamlConfig)
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

---
remark:
  bullet: "*"
---

*   Hello

API

remark().use(yamlConfig)

Plugin to configure the processor with YAML frontmatter. Takes the 'remark' field in the frontmatter and passes it as configuration to remark-stringify.

Just like remark-comment-config, but YAML is more visible.

Security

Use of remark-yaml-config can change how Markdown is parsed or compiled. If the Markdown is user provided, this may open you up to a cross-site scripting (XSS) attack.

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer