Paragraphs and html integration.

Boris Le Ninivin boris.leninivin at gmail.com
Mon Jun 18 13:12:22 EDT 2012


On 06/18/2012 05:53 PM, Waylan Limberg wrote:

> On Mon, Jun 18, 2012 at 6:26 AM, Boris Le Ninivin

> <boris.leninivin at gmail.com> wrote:

>> Hello everyone.

>>

>> In a website, parts of the pages (essentially headers and footers) are often

>> the same. Hence I've added a functionality to my toolkit : inclusion. It is

>> performed when the parser finds "@include filename".

> [snip]

>> 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.

>>

> First, I should point out that while "Markdown is smart enough not to

> add extra (unwanted)<p> tags around HTML block-level tags" that only

> applies to *known* (and valid) HTML block level tags. "@include

> filename" is *not* a known HTML block-level tag - its not even HTML at

> all.

Right. That's why, in the first version, the replacement mechanisms were
applied *BEFORE* any markdown processing. Yet, it put </p> around <html>
even in that case... So you've got my point.

> I'm not sure how you implemented your inclusion stuff, but here's a

> few suggestions:

>

> If you are swapping your inclusion tag after markdown is run, then you

> need to match your inclusion tag wrapped inside a paragraph. Match

> this: `<p>@include filename</p>`.

Some newlines might be added as well, but that's an idea. It would avoid
having <p> tags wrapping the <html> ones, at least.

> If you are swapping your inclusion tag before markdown is run, then we

> need to see what was swapped in to be of any help.

>

> If you have modified markdown (or used PHP Markdown's undocumented

> extension support), make sure your addition is running before raw HTML

> is handled by the parser.

I use the markdown php version from github.

Thanks,
Boris.


More information about the Markdown-Discuss mailing list