Markdown within block-level elements

Michel Fortin michel.fortin at michelf.ca
Wed Sep 17 23:24:07 EDT 2014


Le 17-sept.-2014 à 21:07, Alan Hogan <contact at alanhogan.com> a écrit :

> On Sep 17, 2014, at 4:57 PM, Michel Fortin <michel.fortin at michelf.ca> wrote:
> 
>> I'll just point out that the markdown="1" trick should be credited to John Gruber.
> 
> Thanks. Sorry for getting that wrong.

It's normal to get it wrong. I wrote the first implementation in an experimental branch of PHP Markdown, John [suggested a syntax][1] different from mine, I adopted it. The experimental branch later became PHP Markdown Extra.

[1]: http://six.pairlist.net/pipermail/markdown-discuss/2004-August/000669.html "
Syntax: Markdown processing within block-level HTML"


>> CommonMark interprets it "right" according to your intent, but the Markdown spec by John Gruber is very explicit about block-level HTML elements:
> 
>> I think the spec makes it clear that the content of `<header>` should not be parsed with the Markdown syntax. As for whether the spec is right or wrong in that choice, that is another debate entirely.
> 
> Indeed. To be clear, I am aware of Gruber’s rule (although I forget it from time-to-time as an author), and was hoping to provoke some discussion with the aim of, yes, rallying around the Common Mark decision here. 
> 
> I do not understand why the rule existed in the first place.
> 
> Apart from historical reasons, are there other good reasons to avoid Markdown processing within block-level elements?

I can't find the reference, but if I remember right the idea was that HTML blocks would often be copy-pasted snippets for embeded videos or similar things. In other words, if you paste some HTML in the middle of your text, you likely don't want Markdown to interfere with it, it should just work.


> And as far as those historical reasons go, I hope it’s abundantly clear how very silly it is for a hundred non-interoperable implementations to claim the motivation of “compatibility" to shun the change needed for consensus.
> 
> Break things. Bump the major version. Be part of an ecosystem that actually works.

PHP Markdown adheres as much as possible to what John Gruber intended Markdown to be, based on the spec as well as the code and comments in Markdown.pl, plus all the posts John has made while he was still participating on this list and a few private emails here and there.

The Markdown Extra variant adds some features and makes only one very small breaking change (disallowing middle-word underscore emphasis). Even though the most notable features in it have been praised by John (on this list), I feel "Extra" needs have a distinct name to signal that it's not purely Markdown.

If I write another parser that breaks a few more things (for instance if it implemented CommonMark), I'll use a new name to avoid the confusion while keeping the old parser around for those who needs it. That however wouldn't solve the problem of non-interoperable Markdown implementation unfortunately, it'd just create one more parser.


-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca



More information about the Markdown-Discuss mailing list