md-sections

1.0.0 • Public • Published

md-sections

Get an array of sections (heading + nodes) from a markdown doc, using remark.

Any nodes before the first heading are ignored.

Usage

var sections = mdSections(root)

Args:

  • root: root remark node

Output: Array of objects in the format { heading: node, nodes: <Array>node }

Example

var fs = require('fs')
var remark = require('remark')
var mdSections = require('md-sections')
 
var root = remark.parse(fs.readFileSync('./my-markdown-file.md'))
var sections = mdSections(root)

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i md-sections

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • joshwnj