commonmark/cmark

Tracking backslash escapes?

Opened this issue · 0 comments

I think this is similar/related to #131 and #292, but one thing I noticed is that bare square brackets do not roundtrip:

Input:

[unescaped brackets],  \[escaped brackets\] and [a link](https://example.com)

Output:

\[unescaped brackets\],  \[escaped brackets\] and [a link](https://example.com)

Is there a way to add an attribute that can track the position of escaped characters in a line?

This is useful for me because I'm trying to parse and rewrite documents that have reference links in child documents, and I have to backtrack to identify and protect these links from being overwritten.

(originally reported this in r-lib/commonmark#20)