Possible bug in handling of HTML comments

Tomas Doran bobtfish at bobtfish.net
Mon Jan 14 13:05:11 EST 2008

On 14 Jan 2008, at 02:08, Fletcher T. Penney wrote:


> It appears that the _EncodeAmpsAndAngles routine is being run over

> the comments, converting & and < to the HTML markup.


> I tried adding & and < to $g_escape_table, and then protecting

> them. This seemed to work, but caused other problems and is

> clearly not a viable solution.


> So it looks like there would have to be a specific mechanism in

> place for leaving comments alone, am I correct?


Yep, totally correct.

I'm about to add this into Text::MultiMarkdown (will be in the 1.0.8
release on CPAN in a week or two) - I've attached the diff that I've
made to make this work (and test it).

Please yell if you can think of a better / prettier / quicker way of
doing it? ;)

It's another case that shows up how building a parse tree would be a
better approach (as we wouldn't need to do, then undo the encoding) -
but what I have appears to work right now...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ampsandanglesinhtmlcomments.diff
Type: application/octet-stream
Size: 1973 bytes
Desc: not available
Url : <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20080114/8ee30001/attachment.obj>

More information about the Markdown-Discuss mailing list