remark-yaml-config
Advanced tools
Comparing version 4.0.0 to 4.0.1
{ | ||
"name": "remark-yaml-config", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Configure remark with YAML front-matter", | ||
@@ -28,10 +28,10 @@ "license": "MIT", | ||
"esmangle": "^1.0.0", | ||
"nyc": "^10.0.0", | ||
"nyc": "^11.0.0", | ||
"remark": "^7.0.0", | ||
"remark-cli": "^3.0.0", | ||
"remark-html": "^6.0.0", | ||
"remark-preset-wooorm": "^2.0.0", | ||
"remark-preset-wooorm": "^3.0.0", | ||
"tape": "^4.0.0", | ||
"unified": "^5.0.0", | ||
"xo": "^0.17.1" | ||
"unified": "^6.0.0", | ||
"xo": "^0.18.0" | ||
}, | ||
@@ -56,2 +56,3 @@ "scripts": { | ||
"space": true, | ||
"esnext": false, | ||
"rules": { | ||
@@ -58,0 +59,0 @@ "guard-for-in": "off", |
@@ -15,23 +15,32 @@ # remark-yaml-config [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status] [![Chat][chat-badge]][chat] | ||
Say we have the following file, `example.md`: | ||
```markdown | ||
--- | ||
remark: | ||
commonmark: true | ||
bullet: "*" | ||
--- | ||
1) Commonmark list (this is a parse setting) | ||
* Hello (this is a stringification setting) | ||
``` | ||
And our script, `example.js`, looks as follows: | ||
```javascript | ||
var vfile = require('to-vfile'); | ||
var remark = require('remark'); | ||
var config = require('remark-yaml-config'); | ||
var yamlConfig = require('remark-yaml-config'); | ||
var file = remark().use(config).processSync([ | ||
'---', | ||
'remark:', | ||
' commonmark: true', | ||
' bullet: "*"', | ||
'---', | ||
'', | ||
'1) Commonmark list (this is a parse setting)', | ||
'', | ||
'- Hello (this is a stringification setting)', | ||
'' | ||
].join('\n')); | ||
console.log(String(file)); | ||
remark() | ||
.use(yamlConfig) | ||
.process(vfile.readSync('example.md'), function (err, file) { | ||
if (err) throw err; | ||
console.log(String(file)); | ||
}); | ||
``` | ||
Yields: | ||
Now, running `node example` yields: | ||
@@ -38,0 +47,0 @@ ```markdown |
6151
99