Le 2007-03-05 à 12:25, John Fraser a écrit :

> Markdown tries to avoid wrapping paragraphs around things they're not
> allowed to contain, but it misses the mark often enough to be
> dangerous:
>
>     Like when you <div>don't skip lines</div> around HTML blocks.

I would consider that as a bug. Note that PHP Markdown Extra's HTML  
parser handle this quite well, but this has a cost in complexity and  
speed.


> or
>
>     <p>...when you omit close tags.

I don't think this can be handled correctly in the general case,  
although it certainly could be handled more elegantly for a vast the  
majority of times by considering the paragraph closes at the first  
blank line. I'm not sure it's worth adding a special case for it  
however.


> or
>
>     <div>
>     <div>
>     ...when the parser gets confused (try this one in Showdown or
> Markdown 1.0.2b2).
>     </div>
>     </div>
>
> Those cases could be handled with a couple of fixes to the
> text::balanced HTML parser (and a brand new parser for Showdown).

This last one works fine in PHP Markdown since 1.0.1d. Perhaps you  
could adapt PHP Markdown's balanced HTML parser.


> I'm guessing the other cases of extra paragraphs are mostly things  
> like this:
>
>     <div>
>       <div>
>         This is just one line, so I don't want it wrapped.
>       <div>
>       This is just one line following a block element, so I don't want
> it wrapped.
>      </div>

That's not even valid HTML... It works fine when I change the third  
`<div>` for a closing tag however.


Michel Fortin
[EMAIL PROTECTED]
http://www.michelf.com/


_______________________________________________
Markdown-Discuss mailing list
[email protected]
http://six.pairlist.net/mailman/listinfo/markdown-discuss

Reply via email to