What changed in CommonMark?


#1

In general, as little as possible!

The goal of CommonMark is not to redefine what Markdown is, or change the syntax, but make it parseable and predictable.

We did try to address some minor persistent Markdown complaints we’ve seen across the millions of users in GitHub, Stack Exchange, Reddit, Discourse, pandoc, and babelmark. John MacFarlane documents them here:


In a few cases, I have departed slightly from the canonical syntax description, in ways that I think further the goals of markdown as stated in that description.

There are only a few places where this spec says things that are contradict the canonical syntax description:

  • It allows all puncutation symbols to be backslash-escaped, not just the symbols with special meanings in markdown. I found that it was just too hard to remember which symbols could be escaped.

  • It introduces an alternative syntax for hard line breaks, a backslash at the end of the line, supplementing the two-spaces-at-the-end-of-line rule. This is motivated by persistent complaints about the “invisible” nature of the two-space rule.

  • Link syntax has been made a bit more predictable (in a backwards-compatible way). For example, Markdown.pl allows single quotes around a title in inline links, but not in reference links. This kind of difference is really hard for users to remember, so the spec allows single quotes in both contexts.

  • The rule for HTML blocks differs, though in most real cases it shouldn’t make a difference. (See here for details.) The spec’s proposal makes it easy to include markdown inside HTML block-level tags, if you want to, but also allows you to exclude this. It is also makes parsing much easier, avoiding expensive backtracking.

  • It does not collapse adjacent bird-track blocks into a single blockquote:

      > this is two
      
      > blockquotes
      
      > this is a single
      >
      > blockquote with two paragraphs
    
  • Rules for content in lists differ in a few respects, though (as with HTML blocks), most lists in existing documents should render as intended. There is some discussion of the choice points and differences here. I think that the spec’s proposal does better than any existing implementation in rendering lists the way a human writer or reader would intuitively understand them. (I could give numerous examples of perfectly natural looking lists that nearly every existing implementation flubs up.)

  • The spec stipulates that two blank lines break out of all list contexts. This is an attempt to deal with issues that often come up when someone wants to have two adjacent lists, or a list followed by an indented code block.

  • Changing bullet characters, or changing from bullets to numbers or vice versa, starts a new list. I think that is almost always going to be the writer’s intent.

  • The number that begins an ordered list item may be followed by either . or ). Changing the delimiter style starts a new list.

  • The start number of an ordered list is significant.

  • Fenced code blocks are supported, delimited by either backticks (```) or tildes (~~~).


Floating images
What are the highlights of changes in the CommonMark flavor?
Inconsistency as it “does not collapse adjacent bird-track blocks”
Call it YAMF, leaven the brand, sell it on its merits (not its name)
Is CommonMark really Markdown "compatible"?
Is CommonMark really Markdown "compatible"?
Is CommonMark really Markdown "compatible"?
Call it YAMF, leaven the brand, sell it on its merits (not its name)
#2

#3

I disagree with most of these changes. I feel the goal of Standard Markdown should be to specify the smallest agreed-upon subset of Markdown features coming from the original implementation, and that means not introducing features or changing semantics that better serve your own personal tastes.

Markdown almost always does need a number of extensions to better serve a particular scenario’s needs or tastes, and it is here that a standard base would be good: providing a clear basis in which to clearly and reproducibly specify where these extensions are made.

It’s fine to let different sites and implementations diverge from the standard, and not just because they already do - a site that needs tables, where the community is mostly coming from MediaWiki, will have a different call for table features and syntax than a site that, say, wants an easy way to format tables that are coming from a CSV (such as a statistics forum). Different places have different legacies, and different scopes of interest.

A Standard Markup should define the precedence and syntax rules for the subset of features that all Markdown implementations are expected to provide, that are as close to universally accepted as possible. If an implementation of a core feature defined by Standard Markdown is divergent in a Markdown renderer, it should never elicit a response beyond “oh, yeah, I’ll fix that bug”. If “Standard Markdown” dictates lots of unique and unprecedented quirks, it’s going to yield just another response of “oh yeah, that’s that site where they have all those kooky opinions, whatever,” and nothing gets fixed.

With a simple Standard Markdown base, changes to describe an implementation’s specific flavorings should be as stringently documentable as possible, with a series of “patches” that rarely, if ever, contradict something in Standard Markdown. Markdown implementations are then free to target one of these “flavors” as their own personal “standard” (or provide features of a flavor as options at render time, such as how https://github.com/chjj/marked handles auto-links and other GitHub-Flavored-Markdown features).


Tables vs fenced code blocks, when is something “common”?
#4

To clarify, at a standards level, I disagree with pretty much each change listed, except for these:

I agree with this foremost because it was mentioned as a potential future change in the original Markdown post. It really doesn’t make sense to have a list that starts with “2.” start at “1.” when rendered, and I would consider any implementation that doesn’t set the start attribute of the <ol> to be bugged. Again, though- I mostly only approve because it’s part of the original described feature set that all Markdown implementations derive from.

I’m okay with this, too, as the omission of single-quotes from reference links feels more like an oversight in the original specification than a proper behavior.

I’m okay with this (or at least some of it) for the reasons specified in the document: it’s the way most implementations (including some versions of the “original reference” implementation) work, for sensible performance reasons. The newline-reintroduces-markdown-parsing rule, while an elegant solution to a pressing issue, strikes me as going a little farther than just standardization: is any major implementation currently doing this?

Again, I’m okay with this, so long as it’s standardizing the behavior of existing implementations, or cases that widely differ across implementations. If “nearly every existing implementation flubs up” a list in the same way, it’s not the standard’s place to declare that they’re wrong.


At a flavoring level, I like almost all of these (although I disagree with making every character backslash-escaped, as it makes talking about $VARIABLES_IN_BASH_HEREDOCS, as I had to do just a few hours ago, really frustrating.) I vehemently disagree that they should be considered “standard” features.


#5

@stuartpb Apart from these rules looking very reasonable, in and of themselves (I am not very versed in the many different variations currently out there), are you saying you’d prefer a formal extension system, as opposed to a centralized standard canon for all rules?

I think that might run the risk of invalidating of the effort put in to this standard. Isn’t that exactly what they’re trying to avoid?


Flavored Markdown
#6

Not as I see it. I see the advantage to this standard, like the original HTML5 standard, being a thorough, canonical, sensible description of proper Markdown behavior, that defines how implementations should handle edge cases in their standard supported subset of features.

Right now, lines like these:

<a `href=""`>
`<a href="">`
*a[b*](url)

might be rendered three different ways in three different Markdown implementations. The useful place of a standard would be to make a call, definitively, what rules should be followed to give one correct interpretation, so that any other interpretation is a bug that should be fixed to be in-line with the standard, and have compatibility with other Markdown implementations.


#7

Semi-formal, yes (I’ll make a post about this in a bit).

Basically, I think implementations should write their own standards, written in the form of amendments to the core standard, that document their divergences with as much rigor and clarity as the main standard. This way, other implementations can copy the divergences of others (chjj/marked having an option to support all the features of GitHub Flavored Markdown, as an example), and even file bugs against the original implementation, pointing out where it diverges from the personal standard it describes.


Flavored Markdown
#8

I think that would certainly work for the short-term transition period.

If this were maintained in the long-run (and let’s face it, nobody can keep anyone from writing their own deviating extensions if someone feels the need for one), then it would be preferable to have the main standard, the core MarkDown so-to-speak, already cover as many use cases as possible, in order to minimize any such need for extensions and additions, and to at least discourage actual breaks of the core standard.


#9

Line breaks.

Example 427
foo
baz

Which is exactly the opposite of ‘continuation lines’ found in many markup systems? -1


#10

+++ stuartpb [Sep 04 14 09:10 ]:

although I disagree with making every character backslash-escaped, as it makes talking about $VARIABLES_IN_BASH_HEREDOCS, as I had to do just a few hours ago, really frustrating.) I vehemently disagree that they should be considered “standard” features.

You should use code backticks. (After all, bash also has special
characters that DO have special meanings in Markdown, so if you don’t
use code backticks to quote your bash examples, it’s going to be very
fragile.)


#11

First off, thank you to everyone involved for working on this. It looks like an incredible amount of work and is certainly a very valuable thing to be working on. I’m glad we have such knowledgeable people leading this effort.

I agree with this though. With all the changes here, Standard Markdown is more of a dialect than a standard. If I want to know “what core subset of syntax should I absolutely support to call a formatting language markdown-compatable”, Standard Markdown doesn’t answer that well (if the goal is that everyone should adopt everything in standard markdown–there are a huge number of small changes that make that seem unlikely).

For a language that says “one of our major goals is to make Markdown easier to parse, and to eliminate the many old inconsistencies and ambiguities that made writing a Markdown parser so difficult”, and as someone currently writing a Gruber-Markdown compatable parser, Standard Markdown looks very hard to parse (and given my goals writing my own parser, implementing all or even most of Standard Markdown is not reasonable, but I wish it was small enough that it was).

If the goal of standard markdown is to have a dialect that is wonderful to write in that handles edge cases well, I think the implementation succeeds. It looks wonderful to author content in! It handles edge cases much better than the parser I was previously using or the parser I am currently writing. But if the goal is to standardize markdown as a language that is easy to write parsers for, I think the spec has diverged significantly from this goal.


#12

I have seen many concerns regarding backwards compatibility. Some people strongly oppose any change due to that. They are afraid of breaking things. This is of course understandable.

However, it is obvious to me that “improvement” requires change by definition. No change means no improvement. Smaller changes can be achieved over time without upsetting people too much. Let me list a few examples:

  • The Internet Explorer (IE) used to have a market share of 90% some years ago. It seemed, Microsoft had won the “browser wars”. Today we have a completely different reality. There is a new HTML Standard. Most browsers sticked close to the standard and enjoy today the greater popularity. In the long run, the better standard has made it to the top.
  • These days it is normal to buy a radio, which receives only FM. In the old days we had also AM radio. The AM still has the advantage, that it has a much longer range. But the higher sound quality of FM pushed the good old AM into a corner.
  • Apple comes up with breaking changes much more often than its competitors. Some people including myself get annoyed by it. However, the success of this strategy is easily visible and measurable.

Having said that, I would like to congratulate this initiatve. There will always be different opinions about the details. But, it is obvious to me that this effort is not only useful, but essential.

The changes, which are listed above are IMHO really minor. We have to have the courage to introduce small changes to make markdown more intuitive and unambigious.

With all respect and appreciation to the work of the creator of markdown, he is only one person. The really great things such as XML and HTML5 are achieved by a large community. The authors of standard markdown have opened up their work to public review and that is certainly the right thing to do to achieve broad acceptance.

Thanks.


Default line break handling is inconvenient
#13

spitballing …

Why just one version?

I agree with @stuartpb that there should be a “standard markdown” to “specify the smallest agreed-upon subset of Markdown features.” Every language needs a baseline core of functionality.

That core should also include a good mechanism for extensibility.

The Standard Markdown spec provides at least one method for doing this in the form of allowing embedded HTML. It’s not pretty and it’s not truly “extending” the language (adding syntactic functionality) but it does allow for tables and other things not yet part of the core language. It’s like how C supports embedded assembly language.

I think we also need a cleaner mechanism than that as well.

What about designing with the expectation that websites will be running multiple versions of markdown interpreters simultaneously?

There would be a common core and then dialects with additional functionalities. I think some sites are doing something like this already.

The effort here could be to provide ways to record user/developer preferences through automatic and manual voting mechanisms. Essentially… extend the StackExchange and Discourse voting paradigms to be part of the collaborative software development lifecycle process itself.


#14

That’s what I’m aiming to do with http://flavoredmarkdown.com (minus the “recording user/developer preferences through automatic and manual voting mechanisms” - the popularity of implementations in the real world is a better gauge).


#15

I moved 5 posts to a new topic: Get rid of the backslash to indicate explicit linebreak?


#18

That link (with 139 clicks) is a 404… I’m assuming it died during the project rename. Is there a new link?


#19

See here.