cmark
cmark copied to clipboard
Repeated CommonMark parsing and rendering can converge quite slowly
I don't know whether there's a bug here but perhaps it's interesting:
$ loop() {
> while [ "$x" != "$x1" ] ; do
> echo "$x" ; x1="$x" ; x=$(echo "$x" | cmark -t commonmark)
> done
> }
$ x='x **0*+*=***' ; loop
x **0*+*=***
x **0*+*=**\*
x **0*+\*=*\*\*
x \**0*+\*=\*\*\*
$ x='x __?__0_}__' ; loop
x __?__0_}__
x \_*?**0*}**
x \_\*?**0*}*\*
x \_\*?\**0*}\*\*
At least it does converge.
I wouldn't be worried about this if each line had the same meaning. But they don't, so that points to something less than ideal. It would be worth figuring out the precise step(s) that cause problems (whether in the parser or the renderer), and generating a more targeted bug report.