PHP Markdown: Block tag syntax experiments

Michel Fortin michel.fortin at michelf.com
Sun Aug 22 09:01:53 EDT 2004


Le 21 août 2004, à 23:03, John Gruber a écrit :

> Michel Fortin <michel.fortin at michelf.com> wrote on 08/21/04 at 1:42pm:
>
>> 3.    Some tags, like "script" and "math" should not at all be
>>      altered by Markdown. Currently this works only if they are
>>      not in a paragraph, but consider something like this:
>>
>>          Current time is <script> write_current_time(); </script>.
>>
>>      It get converted to this (obviously wrong):
>>
>>          <p>Current time is <script> write<em>current</em>time();
>> </script>.</p>
>
> Good point. I've filed it as a bug. Do you already have a fix for
> this in PHP?

All the features discussed in the "Experiments" discussed in my last 
email are working well and you can try by yourself on the PHP Dingus 
(select MD Experimental). So yes, I have a fix.

What I do is check for these tag in the _HashHTMLBlocks function (even 
if they are not really block) and replace them with their md5 checksum. 
But they are stored in a different table (I called it 
$md_html_clean_tags) and put back at a different time (in 
_UnescapeSpecialChars).

The function to look for these "don't-touch tags" is recursive 
(nested-tag safe); this is probably not needed for the currently 
supported tags ("math" and "script"). But if we add other tags to the 
list later -- like "[svg][]" -- nested tags may better be supported.

[svg]: http://www.w3.org/Graphics/SVG/ "Scalable Vector Graphics"


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


More information about the Markdown-discuss mailing list