Source information missing from parsed nodes
I'm making a renderer that will modify a tree in-place, but can roundtrip MarkDown back to the same MarkDown (or mostly the same).
There is some information missing from the parsed nodes that would be useful reconstructing the original document. In particular:
- Whether a
code_blockwas originally fenced or indented. - What symbol was used for emphasis, either
*or_.
Can these be added to the parse nodes?
I'm unsure about this, because this is just the tip of the iceberg. Was a character escaped or not in the source? How much indentation was used before a list item? How many backticks were used in the code block? Was a reference or inline link used? Etc. Once you start going down this path, you're looking at a very different kind of parser output, a concrete syntax tree rather than an abstract one.
@rix0rrr
- Node has a property
_isFenced, but no marker char so can not determine marker is`or~ - Emphasis has no marker char
You can add these on your fork. I wrote a parser with reference to commonmark.js, it added these 'meta info', you may take a look.