Closed strarsis closed 3 years ago
sounds good, I will have some test.
we can keep the content as text in the children array, but it would not be identifyable as comment. it could be an object like {comment: 'content'}
, but it might break some other code in simplify transformations as the object is not a node.
Not sure now, what the best solution is, maybe it would require a breaking change. what can be ok to make a version 4.
you can now pass an option into the parser o
txml.parse(text, {keepComments: true})
.
then comments are returned as string. It is possible to see if a string was a comment with s.startsWith('<!--') && s.endsWith('-->)
.
It would be nice to have an option to parse comments, too. Sometimes comments in the AST can be useful. As an optional option, this wouldn't unnecessarily impede performance.