php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

Standard Markdown?

Open skyzyx opened this issue 9 years ago • 11 comments

As the preeminent implementation for PHP, does this follow the newly-published spec for Markdown (and its test suite)?

http://standardmarkdown.com

skyzyx avatar Sep 04 '14 06:09 skyzyx

Finally a spec for markdown !

ghost avatar Sep 04 '14 07:09 ghost

No it doesn't. As far as I'm concerned, "Standard" Markdown is just one more variant of Markdown with its own featureset. The novelty of this variant is that it claims to be "standard" and has a more detailed spec than most and that most of it is based on some compromise between what current implementations do. It's a good piece of work, but there are some part of the spec I disagree with.

Feel free to pass PHP Markdown through the test suite to see the differences (and if you do, please post the results here, I'm interested). If you post issues for those divergences, I'll consider changing the parser, but there being a divergence doesn't automatically mean I'll consider the divergence a bug.

michelf avatar Sep 04 '14 11:09 michelf

My first reaction was "Yay! inconsistencies will be squashed!" But now that I've gotten into the site a bit and seen Gruber's reaction I'm starting to notice holes. I do like the idea of GitHub and others trying to make sure they don't stray too far in their implementations. And a test suite is a great tool to have. But I'd have to agree with @michelf that as the old xkcd comic goes it is just another variant to add to the pile.

Not to take too much of your time, but I'd be curious what parts of the spec you disagree with. Got an example or two?

vagari avatar Sep 04 '14 19:09 vagari

@vagari Obligatory XKCD reference: http://xkcd.com/927/ That said, if their new standard replaces two or three existing ones then the situation might get better.

I haven't looked too throughly, but from the various examples I notice a few new features and subtle differences here and there (protocols accepted in automatic links, whitespaces in automatic links, second numbered list syntax, breaking lists in two or more when mixing different list markers, different priorities for some things, surely many other things. Notably, underscore emphasis is following the Markdown Extra rule, quite strange for that to be called "standard" Markdown.

michelf avatar Sep 04 '14 19:09 michelf

@michelf thank you for your work on this project. I use your implementation in production on a few projects.

Once I learned about the MD standards project I popped over here to see if anybody had brought it up. Glad it has and curious to see where this goes...

phirschybar avatar Sep 06 '14 03:09 phirschybar

Started testing some Markdown variants on cases that I often use, but are often b0rk'd by parsers.

https://gist.github.com/skyzyx/2b3183cd890affd877a4

skyzyx avatar Sep 06 '14 07:09 skyzyx

The link on top is dead as they are now http://commonmark.org/

Mikaela avatar Mar 18 '15 19:03 Mikaela

It would still be helpful if you could document where PHP Markdown differs from Commonmark and whether that is considered a bug or a disagreement.

(Since GFM is now just a collection of extensions on top of CM, it hasn’t really increased the number of “standards”.)

Crissov avatar Mar 06 '18 12:03 Crissov

PHP Markdown (non-extra) is pretty much equivalent to the original Markdown.pl (minus some fixed bugs). Any way CommonMark deviates from the original Markdown it'll deviate from PHP Markdown too. If CommonMark has documented how it deviates from the original then you mostly have what you need to know.

I'm not going to research all the ways in which the output may differ between the two. If someone wants an opinion about a particular case, open an issue I'll to take a look.

For fun here's one noteworthy difference. And here's a more subtle one.

michelf avatar Mar 06 '18 16:03 michelf

Hm, I guess it would help already if you could publish the results of the CM conformance tests run with PHP Markdown. The testsuite is more complete than Gruber’s as far as I tell, so you might even identify stuff that you would like to change.

Crissov avatar Mar 06 '18 19:03 Crissov

Anyone interested can run the tests and publish. And I'd be happy to look at them, although I don't expect to see anything I'll want to change. PHP Markdown is first and foremost an implementation of the original Markdown, not CommonMark, and replicating quirks of the original is often desirable in order to avoid breakage of old document.

That said, if someone wants to implement 1) a "CommonMark mode" that tweaks the appropriate parts when enabled, or 2) a derived parser class like MarkdownExtra but for CommonMark, it might be worth including.

@Crissov So why are you so interested in this?

michelf avatar Mar 06 '18 21:03 michelf