remark-replace-block
v1.0.0
Published
remark plugin to replace block context
Downloads
1
Readme
remark-replace-block
remark plugin to replace block content.
Note: if the block content is not found, the replace nodes is will added to the end.
Install
npm:
npm install remark-replace-block
Use
We have the following file, example.md
# title
## API
- this one
- this two
And the script, example.js
const remark = require('remark');
const replaceBlock = require('remark-replace-block');
const vfile = require('to-vfile');
remark()
.use(replaceBlock, { type: 'heading', depth: 2, value: 'API' }, '## update\n* - this is change')
.process(vfile.readSync('example.md'), function (err, file) {
if (err) throw err
console.log(String(file))
})
Yields:
# title
## update
- this is change