Configure remark with YAML front-matter.
:warning: mdast is currently being renamed to remark :warning:
This means all plug-ins and relating projects change too, causing many
changes across the ecosystem. Expect the dust to settle in roughly a day.
See this project at the previous stable commit
c4a51d1.
Installation
npm
npm install remark-yaml-config
Component.js
component install wooorm/remark-yaml-config
Bower
bower install remark-yaml-config
Duo
var yamlConfig = require('wooorm/remark-yaml-config');
UMD: globals, AMD, and CommonJS (uncompressed and compressed):
<script src="path/to/remark.js"></script>
<script src="path/to/remark-yaml-config.js"></script>
<script>
remark.use(remarkYAMLConfig);
</script>
Table of Contents
Usage
var yamlConfig = require('remark-yaml-config');
var remark = require('remark').use(yamlConfig);
var input = [
'---',
'remark:',
' commonmark: true',
' bullet: "*"',
'---',
'',
'1) Commonmark list (this is a parse setting)',
'',
'- Hello (this is a stringification setting)',
''
].join('\n');
var tree = remark.parse(input);
Stringifying the document yields:
var doc = remark.stringify(tree);
---
remark:
commonmark: true
bullet: '*'
---
1. Commonmark list (this is a parse setting)
* Hello (this is a stringification setting)
API
Passes the configuration
found in YAML front-matter (under the remark
key) to remark.
This is especially useful if you’re using remark’s CLI,
which allows multiple documents to be processed in one go, but you’d like
certain files to have different formatting.
Signatures
remark = remark.use(yamlConfig, options?)
.
Parameters
yamlConfig
— This plugin;options
(Object?
) — Passed to remark-yaml.
License
MIT © Titus Wormer