Possible bug in handling of HTML comments

Fletcher T. Penney fletcher at fletcherpenney.net
Sun Jan 13 21:08:33 EST 2008


So, another example:

Test & < > <!-- Test & < sd > --> Test

<p>Test & < > <!-- Test & < sd > --> Test</p>

produces:

p>Test &amp; &lt; > <!-- Test &amp; &lt; sd > --> Test</p>

<p>Test & < > <!-- Test & < sd > --> Test</p>

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?


Thanks!

Fletcher


On Jan 13, 2008, at 8:06 PM, Fletcher T. Penney wrote:


> It appears that Markdown will process ampersands contained within

> HTML comments if that comment is part of a markdown paragraph, but

> will not when that paragraph is contained within an HTML block of

> it's own (and therefore ignored by Markdown.)

>

> For example:

>

> This is a markdown paragraph with a comment that *will* be processed

> <!-- This & *will* be converted -->

>

> <p><!-- This & will *not* be converted --></p>

>

> It seems to me that the & within a comment should be ignored by

> Markdown and not converted to &amp;

>

>

> The reason this is important for me, is that I am experimenting with

> using HTML comments as a means to pass text that should be ignored

> by MultiMarkdown (e.g. to allow raw LaTeX, etc). But some of the

> comments *are* being processed, which screws them up.

>

>

> Thanks for any insight, and ideas on how to fix this!

>

>

> Fletcher Penney

>

>

> --

> Fletcher T. Penney

> fletcher at fletcherpenney.net

>

> Without question, the greatest invention in the history of mankind

> is beer. Oh, I grant you that the wheel was also a fine invention,

> but the wheel does not go nearly as well with pizza.

> - Dave Barry

>




--
Fletcher T. Penney
fletcher at fletcherpenney.net

Without question, the greatest invention in the history of mankind
is beer. Oh, I grant you that the wheel was also a fine invention,
but the wheel does not go nearly as well with pizza.
- Dave Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2437 bytes
Desc: not available
Url : <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20080113/3155e2e5/attachment.bin>


More information about the Markdown-Discuss mailing list