cmark icon indicating copy to clipboard operation
cmark copied to clipboard

A***B*C* doesn't roundtrip

Open kivikakk opened this issue 6 years ago • 1 comments

See https://github.com/kivikakk/comrak/issues/111 -- the string A***B*C* doesn't roundtrip correctly. It's not exactly well-formed, but ideally we should be consistent.

kivikakk avatar Apr 02 '19 03:04 kivikakk

See https://github.com/kivikakk/comrak/issues/111 -- the string A***B*C* doesn't roundtrip correctly. It's not exactly well-formed, but ideally we should be consistent.

This one is really tricky to get right, because the behavior turns on the "multiple of 3" rule. That first asterisk is literal, so the writer backslash-escapes it, but that changes the initial delimiter run from *** to **, and now it can't form emphasis because of the "multiple of 3" rule. Argh!

It's hard to see how the writer can know it's safe to leave out the backslash without actually parsing its candidate rendering and comparing the result. Maybe that approach could be considered, though, since efficiency presumably isn't as important for generating commonmark as it is for generating HTML.

See also #131.

jgm avatar Apr 10 '19 15:04 jgm