A few strange behaviours or bugs?

Michel Fortin michel.fortin at michelf.com
Sat Oct 30 18:39:34 EDT 2004


Hi Jim,

This is because you have nested div tags. Markdown (the syntax) 
currently has a limitation with this. If you want to nest block-level 
tags you must indent the content like this:

<div>
	<div> -- Indented div tag
	</div>
</div>

When Markdown encounter a block tag, it simply consider it as one block 
until it finds a closing tag on the beginning of the line. The first 
closing div tag in the previous example is indented so it doesn't count 
as the end of the block; the second one does.

If you do not indent the inner div you get the following (incorrect) 
interpretation by Markdown:

<div>  -- Start of block
<div>
</div> -- End of block
</div> -- Paragraph?

So you must indent closing div tags that are inside another div, or 
else strange things happen.

I'm happy to tell you that this indentation rule will become irrelevant 
in a future version of Markdown and PHP Markdown.


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

Le 30 oct. 2004, à 17:01, Jim Byrne a écrit :

> Hi Michel,
>
> Thanks for the quick reply.
>
> I apologize for my lack of detail.
>
> Markdown was not used to enter the source on these pages - it was all
> entered by hand as HTML. I have had a read through the pages you 
> mention -
> and noted the advice about putting blank lines before and after block 
> level
> elements - unfortunately that does not seem prevent the extra 
> paragraph tags
> being added.
>
> For example, in the page at http://www.gawds.org/show.php?contentid=97 
> the
> entire content (added via a form) is bracketed by <div> and </div>. 
> When I
> space out the HTML to ensure there is blank lines separating these 
> block
> level elements - the final </div> is processed by Markdown and becomes
> <p></div></p>.
>
> Please prompt me for further detail if required.
>
> Thanks - I appreciate your help.
>
> All the best,
> Jim



More information about the Markdown-discuss mailing list