<footer> and cie.

Waylan Limberg waylan at gmail.com
Fri Feb 8 19:25:09 EST 2013


On Fri, Feb 8, 2013 at 4:38 PM, Michel Fortin <michel.fortin at michelf.ca> wrote:

> In PHP Markdown 1.0.1p I started treating them as block-level elements and they get the same treatment as `<div>`, but implementations don't seem to agree on this


I see three different outputs (babelmark2 shows more, but treatment of
whitespace and/or the encoding the apostrophe in "don't" are throwing
things off).

1) `<footer>` and its contents are untouched.
2) `<footer>` is left alone but its contents are processed as inline markdown.
3) The whole thing is wrapped in a `<p>` and contents are processed as
inline markdown.

The reason for #3 is easy. Those parsers don't know anything about the
`<footer>` tag - which we all know is new in HTML5. Most likely, they
(like markdown.pl) have a hardcoded list of block level tags and
anything else in raw html is assumed to be span level tags. As I see
it, these can simply be ignored as being outdated/not supporting
HTML5. My suggestions would be to say that if you want to use HTML5
don't use these implementations. Yes, that means HTML5 support is a
feature, just like footnote support is a feature. Uhg.

I think it is safe to say that the reason for #1 is that the devs have
added the footer tag to the list of hardcoded block level tags - which
means it gets missed by span level parsing. These implementations can
say they support HTML5, but the lack-of-span-level-parsing feels
limiting.

I'm guessing that implementations of #2 work as they do because a
conscious decision was made to allow span level parsing. But what do
these implementations do for divs? I just checked and they also do
span level parsing inside `<div>` and `<p>` tags, etc.

http://johnmacfarlane.net/babelmark2/?normalize=1&text=%3Cp%3E%E2%80%94+%5BIgor+Wiedler+wins%5D(https%3A%2F%2Figor.io+)%3C%2Fp%3E%0A%0A%3Cdiv%3E%E2%80%94+%5BIgor+Wiedler+wins%5D(https%3A%2F%2Figor.io+)%3C%2Fdiv%3E%0A%0A%3Cfooter%3E%E2%80%94+%5BIgor+Wiedler+wins%5D(https%3A%2F%2Figor.io+)%3C%2Ffooter%3E

So, if you want to follow the
no-span-level-parsing-in-block-level-html rule, your left with
choosing #1 or #3 (the former being with HTML5 support). However, if
you want to ignore that rule, then #2 seems to be the way to go.

Personally, I've never liked that rule
(no-span-level-parsing-in-block-level-html), but it is a clearly
defined rule and should be the default behavior. I went with #1.

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


More information about the Markdown-Discuss mailing list