markdown-ast icon indicating copy to clipboard operation
markdown-ast copied to clipboard

Incremental parsing

Open aleclarson opened this issue 6 years ago • 0 comments

Nodes intentionally lack location properties, so they can be mutated, moved, and/or removed with minimal effort. Sometimes, this lack of information makes any code modifications harder to carry out. Transform phases would be much easier with "incremental parsing".

const md = require('markdown-ast')
const parser = md.generator(input)

// The `next` method returns null when EOF is hit.
while (parser.next()) {
  // The `next` method updates `node` and `offset`
  const {node, offset} = parser
}

aleclarson avatar Nov 26 '18 17:11 aleclarson