Open hadrava opened 6 years ago
There is an attempt to unify markdown dialects by CommonMark project (http://commonmark.org/). Unfortunately it is still not easy to use from Perl (on current Debian). It needs special setup of libcommonmark and Perl module CommonMark form CPAN. So it would make deployment of WebTaskSubmitter a real nightmare.
I have created a hack: we can call external binary cmark instead of Perl module. (And use official CommonMark JavaScript implementation for previews.)
Have a look at commit hadrava/WebTaskSubmitter@9c501297051424bcc4ab9fe454194b10e5a33b8d if you are interested. This commit also contains binary cmark for x86_64 Linux. There is also simple script render-commonmark.pl which re-renders all comments in the database. (It is useful if you have already used fenced code blocks and want to fix them).
I'm not filling a pull request because this is just a hack. But feel free to use this, if you stumble upon same problem. Calling external process isn't nice, but fortunately this process is called only when new comment is added.
Hi,
if you use fenced code blocks (separated by three backticks ```) in the comments, everything seems to be fine in the preview. But it does not work when after you add that comment.
WebTaskSubmitter uses two different parsers of Markdown. JavaScript version is used for preview. Perl version renders the final version. These two parsers produce significantly different output. So the preview function does not serve its purpose.
Perl version is much more similar to original implementation: https://daringfireball.net/projects/markdown/ and does not support fenced code blocks. Unfortunately fenced code blocks are quite common in Markdown examples and tutorials.
It is not necessary to have both parsers completely same. They should at least agree on basic constructions.