Paragraphs and html integration.

Waylan Limberg waylan at gmail.com
Mon Jun 18 20:00:27 EDT 2012


On Mon, Jun 18, 2012 at 7:31 PM, Boris Le Ninivin
<boris.leninivin at gmail.com> wrote:

> On 06/18/2012 09:27 PM, Michel Fortin wrote:

>

> Le 2012-06-18 à 6:26, Boris Le Ninivin a écrit :

> In the end, on the df website, it is said that "Markdown is smart enough not

> to add extra (unwanted) |<p>| tags around HTML block-level tags.". So I

> don't know if it's an implementation problem (related to the PHP port,

> maybe?), or if it's a design problem, but as far as I know, Markdown is not

> smart enough to not add unwanted <p> tags.

>

> That's only true for known HTML tags, and only the block-level ones.

>

> Does that mean that <html> and <!doctype > tags will be enclosed between <p>

> ?


Yes. More specifically, known block-level tags that would only ever
appear inside the <body> of a valid HTML4/XHTML1 document are
recognized by Markdown. So any new tags introduced by HTML5 would also
not be recognized - although some implementations may be starting to
add them.

Also remember that those tags must begin at the start of a line. No
indentation allowed - or they not recognized as block level tags. Yes,
this is documented - so most implementations follow it.

If your adding <html> stuff to your documents, that is generally
handled after markdown is run on the body. For example, most
frameworks and template systems will use a template which generates
all the stuff outside the <body> and perhaps a header/footer inside
the body, and then use a template variable to insert the already
converted markdown into the document. Markdown does not generally
expect to have the already generated document run through it -
although I know some people have had success using it that way in
specific controlled environments.

--
----
\X/ /-\ `/ |_ /-\ |\|
Waylan Limberg


More information about the Markdown-Discuss mailing list