remark-replace-block

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i remark-replace-block

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

4.6 kB

Total Files

4

Last publish

Collaborators

  • bigwinds