Package Exports
- remark-behead
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-behead) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
remark-behead
Increase or decrease heading depth
Remark-behead is a remark plugin to increase or decrease heading depths. Passing a negative value to the depth option will decrease the heading depth. Passing a positive value to the depth option will increase the heading depth.
Table of Contents
Install
npm install --save remark-beheadUsage
const behead = require('remark-behead')
const remark = require('remark')
remark()
.use(behead, { after: 0, depth: 1 })
.process([
'# foo',
'# bar',
'# baz'
].join('\n'))
.then(vfile => vfile.toString())
.then(markdown => console.log(markdown))
.catch(err => console.error(err))
/*
* result :
*
* # foo
*
* ## bar
*
* ## baz
*
*/
Options
options.after
Manipulates heading nodes after but not including the given string. Behead will start working after the first occurrence of the given string.
example
remark()
.use(behead, { after: 'foo', depth: 1 })
.processSync('# foo\n# bar\n# baz')
/* # foo\n\n## bar\n\n## baz\n */options.before
Manipulates heading nodes before but not including the given string. Behead will stop working at the first occurrence of the given string.
example
remark()
.use(behead, { before: 'baz', depth: 1 })
.processSync('# foo\n\n# bar\n# baz\n')
/* ## foo\n\n## bar\n\n# baz\n */options.between
Manipulates hading nodes between but not including the two given strings, starting with options.between[0] and ending with options.between[1].
example
remark()
.use(behead, { between: [ 0, 'baz' ], depth: 1 })
.processSync('# foo\n# bar\n# baz')
/* # foo\n\n## bar\n\n# baz\n' */Tests
npm install
npm testContribute
PRs accepted and greatly appreciated.
License
MIT © mrzmmr