php > include "markdown.php";
php > echo Markdown("</div>");
You're seriously asking Markdown to fix your HTML for you?
If you write an invalid HTML block as the input, you'll get invalid HTML in the output. The invalid thing isn't generated by Markdown in this case.