treating doctype and php as block-level elements

Michel Fortin michel.fortin at michelf.com
Sun Nov 20 00:10:13 EST 2005


Le 2005-11-19 à 23:02, Yuri T. a écrit :


> Of course this shouldn't be limited to PHP, so it might be just better

> to treat all tags starting with <?, <@ and <% this way.


PHP Markdown Extra already does this for PHP code. But it's not
following closely the PHP syntax, it's following the processing
instruction syntax of xml. So this will be left alone:

<?php echo "Hello World" ?>

while this will be wrapped in a paragraph:

<?php echo preg_replace('/(?> W+)/', '_', "Hello World") ?>

because according to the XML spec, a processing instruction stops at
the first `?>` (quoted or not), and what follows is taken as text.
This match the web browser behaviour about processing instructions in
HTML and XML.

So while it supports PHP, there is some sort of limitation to that.
Which bring the question: what should be the rules for `<!`, `<@`,
and `<%` support; and how far should we go with all these syntaxes?


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




More information about the Markdown-Discuss mailing list