cmark icon indicating copy to clipboard operation
cmark copied to clipboard

Repeated CommonMark parsing and rendering can converge quite slowly

Open egrimley opened this issue 6 years ago • 1 comments

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.

egrimley avatar Dec 21 '19 10:12 egrimley

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.

jgm avatar Dec 21 '19 17:12 jgm