vmg / sundown

Standards compliant, fast, secure markdown processing library in C
1.99k stars 385 forks source link

Degree of Markup.pl compatibility #22

Closed kjk closed 13 years ago

kjk commented 13 years ago

This maybe is a question rather than a bug report.

Since the tests are not part of the sources, I've modified upscript.c in my repo (https://github.com/kjk/upskirt/blob/master/examples/upskirt.c) to run the test against 1.0.3 markdown test files from https://github.com/jgm/peg-markdown/tree/master/MarkdownTest_1.0.3/Tests

The test reads the .text file, renders it to html with ups_markdown() and compares to .html reference result (after trimming whitespace at the beginning of the line and collapsing empty lines).

10 tests fail.

Am I using the wrong test files? (those are the only ones I managed to track down).

The tests do look a bit fishy, e.g. in "Amps and angle encoding.text" < in "4 < 5." is supposed to be converted to &lt; while > in "6 > 5." stays as > (and the code, apparently correctly, converts it to &gt;).

So:

vmg commented 13 years ago

Hey Krzysztof, thanks for your concern!

There is full compatibility with the official Markdown Test Suite (1.0.3) -- the link to the test suite from peg-markdown looks like the correct version. If your tests are not failing, make sure that:

  1. Your upskirt.c file is rendering with no extensions enabled:

    upshtml_renderer(&renderer, 0);
    ups_markdown(ob, ib, &renderer, 0);
    upshtml_free_renderer(&renderer);
  2. You are running the test suite from the official MarkdownTest.pl script, like this:

    ./MarkdownTest.pl --script ~/src/upskirt/upskirt --tidy

    Note the importance of the --tidy flag: the generated HTML must be tidied up before comparing because e.g. Markdown.pl may generate

    <p>This is HTML</p>

    And Upskirt may generate:

    <p>
       This is HTML
    </p>

    Both are exactly the same piece of HTML, but a naive comparison with diff will consider them different.

I hope this fixes your issue -- if you happen to find any failing tests, please report back.

Cheers!

kjk commented 13 years ago

Thanks for the info. I'm not using tidy and Markdown.pl since I'm on windows and it's a bit hard to set up so I'm just comparing what upskirt generates with the reference .html file (after normalizing whitespace).

It's plausible that after tidy > and &gt; become the same thing (> is in the reference html and upskirt generates &gt;)