1.0.0 • Published 8 years ago

md-sections v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

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