What is the canonical implementation of markdown?

2019-04-03 10:24发布

问题:

The problem with writing my own Markdown parser in Clojure is that Markdown is not a well-specified language. There is no "official" grammar, just an informal "Here's how it works" description and a really ugly reference implementation in Perl. http://briancarper.net/blog/415/

I can see Gruber's specification here and the implementation here.

This is an implementation that wins the google ranking test here

Then there is peg-markdown which appears to solve the 'there is no grammar' problem - but is not the canonical implementation.

My question is - what is the canonical implementation of markdown? (The one that everybody says defines the standard).

EDIT:

I acknowledge that "there is no canonical standard". I'm looking for the next best thing.

The answer seems to be showdown.js, but there are problems with it.

(using the definition of canonical being the one that everybody says defines the standard).

It gets referenced here and on github here.

I'll throw in pagedown as well (as aluded to by @deceze) because it appears to fix the bugs in showdown and be a little closer to Gruber's original.

回答1:

I believe Gruber's is the original and sort-of-canonical (see, for example, his 'Introducing Markdown'), and then people have extended it from there. I think some extensions are more common than others though, so it's probably worth seeing what a few well-used packages have over his original.



回答2:

The CommonMark project attempts to address some of the issues of the Markdown specification, in particular some ambiguities. It comes with a reference implementation, but that's obviously just the reference implementation for CommonMark, not for Markdown in general. It may become the de-facto standard in years to come, since some major users are involved in that project, but it might as well become just another dialect among many, in which case the reference implementation would add little value.