2018-02-02 Markdown

I’m having fun implementing the CommonMark Spec 0.28 for Oddmuse using their spec file for automated testing. Current status:

# Looks like you failed 493 tests of 624.

Implementing simple stuff is fun. :)



OK, sometimes it is not as fun it could be:

This is not emphasis, because the closing * is preceded by whitespace:
*foo bar *

This is hard for the Oddmuse parser because it works like a state machine and prints immediately when looking at every token. So for Oddmuse, starting at the first * it sees a legal beginning of emphasis and prints <em> without considering whether there is a legal end to this emphasis. Oddmuse will print the closing tag when the paragraph ends. But that’s not what CommonMark wants us to do. And I can’t use a simple positive look-ahead as that will fail in this situation as the closing emphasis is actually within a code element and thus it seems to me that I need to parse and backtrack in order to solve this problem. Gaaaah.

*foo `bar* bar`

– Alex Schroeder 2018-02-03 13:03 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.