Hi All!
I have implemented a PetitMarkdown grammar for PetitParser according to the
CommonMark 0.19 specification (
http://spec.commonmark.org/0.19/). The
current implementation can be loaded like this:
Gofer new
url: 'http://smalltalkhub.com/mc/JanKurs/PetitParser/main';
package: 'PetitMarkdown';
load.
The result of the parsing is AST, so I guess there is a possibility to
write a CommonMark -> Pilar AST transformation. I wrote the AST->HTML
visitor only.
CommonMark uses two pass strategy. The block elements are recognized in the
first phase and the inline elements in the second phase. My implementation
handles the first phase without any problems, there are some issues with
the priorities of inline elements and emphasis (I don't understand, why
more than 50% of the whole specification covers this). There are in total
550 example, the current implementation handles 420 of them so far. I guess
for the most users it handles more than enough,...
If anyone is interested in using it/fixing it/improving performance, I am
more than willing to help you. Some of the rules are pretty crazy, so I
guess it will take some time before we find best solutions.
Cheers,
Jan