[Bug] PHP Markdown (Extra) generates invalid HTML for code blocks

Michel Fortin michel.fortin at michelf.com
Sun Sep 2 16:52:22 EDT 2007


Le 2007-09-02 à 12:32, Milian Wolff a écrit :


> May I ask which parser you use? I wrote my own for the rewrite of

> html2text.php. I just applied it as a sourceforge project, if you are

> interested you might have a look into it the next week.


MDTest uses the DOMDocument->loadHTML function[^1] available in PHP 5:

<http://ca.php.net/manual/fr/function.dom-domdocument-loadhtml.php>

It produces a DOM, which can be normalized for whitespace, then
reserialized as HTML and compared with the expected result file. The
upside is that it's pretty fast. The downside is that it ignores
misnested tags like this one.

I think I will use the XML parser instead. That will work, except for
a few cases where non-XHTML HTML blocks are passed unchanged through
Markdown.


[^1]: PHP 5 DOM functions, including HTML parsing, are based on libxml2.


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/




More information about the Markdown-Discuss mailing list