Running the following code: ``` var commonmark = require('commonmark'); var reader = new commonmark.DocParser(); var readme = "X\n" + "---\n" + "Bar\n" ``` var parsed = reader.parse(readme); console.log(parsed); Results in the following: { t: 'Document', start_line: 1, start_column: 1, end_line: 1, children: [ { t: 'Header', start_line: 1, start_column: 1, end_line: 2, inline_content: [Object], level: 2, children: [] }, { t: 'Paragraph', start_line: 3, start_column: 1, end_line: 2, inline_content: [Object], children: [] } ] } On the last child, the end_line is smaller than the start_line. That doesn't seem right. In fact, it should be 1 larger than it is.
Activity
jgm commentedon Jan 10, 2015
Thanks, I think I've fixed this now.
Note that there have been some major changes in master.
The parser now returns a 'Node' object, which uses doubly linked
lists rather than arrays.
However, you can still get something similar to the old structure by
using the
toAST()method.Instead of
start_line,end_line, etc., we now have apospropertythat looks like this:
pos: { [start-line, start-column], [end-line] }.