|
|
Log in / Subscribe / Register

A common Markdown

By Nathan Willis
September 10, 2014

The Markdown text-markup format was created in 2004 by John Gruber, and has been widely adopted—especially in applications where some sort of text formatting is desirable, but full HTML is, for some reason, considered overkill. Despite its wide adoption, though, there have long been differing interpretations of various ambiguities in the canonical description of the format, leading to incompatible implementations. Now a small team of Markdown enthusiasts has decided to publish a more formal specification that can be used as a strict guidebook for implementers concerned about valid formatting.

The effort is being led by Jeff Atwood (most recently of Discourse fame), along with Etherpad creator David Greenspun, Vicent Marti of GitHub, Neil Williams of Reddit, Benjamin Dumke-von der Ehe of Stack Exchange, and John MacFarlane, creator of the pandoc text-file converter. Atwood and Greenspun first began discussing the need for a standardized Markdown specification in late 2012, after noting the incompatibilities between the various Markdown implementations available, the lack of Markdown test suites, and Gruber's apparent disinterest in leading—or even participating in—any effort to repair shortcomings in the official description of the format.

Mark questions

Gruber's description of the Markdown syntax is essentially a static document that resides at his personal site, and in many ways is informal. There is no version number and Gruber has not made additions to it, even when Markdown users have made suggestions. And the heavy users of Markdown on the web do indeed seem to find several markup options missing, which has led to several popular sites each supporting its own tweaked version of the format. Beyond taking their suggestions, many Markdown users seem to lament the fact that Gruber will not host any sort of open standard-writing process.

The GitHub flavor, for example, differs in a number of respects where code markup is concerned—such as ignoring intra-word underscore characters, which are used to indicate italics in the official Markdown, but which often need to be used variable and function names (and, thus, should not be interpreted as markup). It also adds text strikethrough, table support, and indentation. The Stack Exchange variant also supports several additions of its own, such as automatic hyperlinking of URLs and [tag: ] elements.

More fundamentally, though, there are ambiguities with respect to how Markdown should be converted to HTML, which can lead to considerable variation in the output of competing Markdown conversion tools. For example, Gruber's description of Markdown does not indicate whether or not a blank line must precede a block quote or a header element. Most implementations do require a blank line, though, because Markdown's delimiter for these elements (the ">" and "#" characters, respectively) can easily appear as the first character on the line in normal, unformatted text. This is rarely the case for many other delimiters, such as sequences of multiple punctuation characters.

There are also no formal rules describing the precedence of markers for nested elements, how combinations of block-level and inline markup should be parsed, and which elements can be nested within others. In Markdown's early days, users would look to Gruber's original Markdown-conversion Perl script as the reference implementation of sorts, but it was inconsistent and buggy enough that it did not serve that function well.

Atwood ran a relatively simple Markdown sample through MacFarlane's online Markdown comparison tool Babelmark, and counted fifteen different output variations from the 22 Markdown converters tested. Admittedly, many of those differences are minor (such as the use of blank lines and white space), and some would seem to violate common-sense expectations (such as generating an unordered list from numbered input), but the point remains that HTML output is not entirely predictable for a given Markdown input. Moreover, there is only one known Markdown test utility, MDTest, and it encodes its own take on the ambiguities for the format, so few if any implementations pass it.

Standard Markdown

In a September 3 blog post, Atwood announced the public availability of the standardization work. Called, at that point, "Standard Markdown," the effort included a specification, inline examples, and reference implementations in both C and JavaScript.

Shortly after the announcement was made public, though, news of the project evidently reached Gruber, who was less than pleased. Atwood reported on September 5 that he and MacFarlane both received an email from Gruber describing the name "Standard Markdown" as "infuriating" because it implied an official status. Gruber asked them to rename the project, as well as to shut down the site (standardmarkdown.com) without redirecting it and to apologize to him. In the post, Atwood noted that he had invited Gruber to participate in the standardization project in 2012, but never heard back, and that he had also contacted Gruber in August asking for his feedback on the soon-to-be-published Standard Markdown work, but again received no reply.

Atwood agreed to Gruber's requests for a name change and apology, and sent him a list of candidate replacement names asking for his opinion. When Gruber again did not reply, Atwood and the others announced that their new name for the project would be "Common Markdown." Unfortunately, it seems, that choice was also not acceptable to Gruber. In an addendum to the September 5 post, Atwood said that Gruber had emailed again to say "that no form of the word "Markdown" is acceptable to him in this case", and that, as a result, the project was now adopting the name CommonMark.

Gruber's apparent hostility to the notion of others contributing to the further development of Markdown is, at least in Atwood's view, not a new position. In 2009, Atwood had commented on Gruber's disinterest in making updates to Markdown, citing his "passive-aggressive interaction" with the user community as a persistent problem. It could certainly be argued that some of Atwood's comments about Gruber, particularly in 2009, exhibited a fair amount of rancor as well, but at least the public messaging about the launch of CommonMark has been almost entirely free of personal criticisms about Gruber. That may not be sufficient to earn Gruber's blessing, but the project appears to be more focused on attracting the input of other Markdown users than on winning over the format's original creator.

CommonMark

The CommonMark specification was written primarily by MacFarlane, based on the input of the other project participants. It is considerably more formal than Gruber's description of Markdown; each markup element is described in precise terms that describe not only which variations are permissible, but listing the non-permissible options as well—and showing examples of each case.

For example, the horizontal rule corresponding to the HTML <hr /> element is defined as:

A line consisting of 0-3 spaces of indentation, followed by a sequence of three or more matching -, _, or * characters, each followed optionally by any number of spaces, forms a horizontal rule.

In addition, the description includes 19 examples of correct and incorrect Markdown input along with the HTML output that compliant implementations should produce. If there was any doubt about whether or not spaces are allowed before, in between, or after the three -, _, or * characters, there is an unambiguous example of each.

Similarly, the examples show how the horizontal rule element should be interpreted when used in combination with paragraph markers, lists, headers, and other elements. Moreover, in instances where existing Markdown implementations varied in their interpretations, the CommonMark specification explains the options and provides an explanation for its choice. In some cases, interestingly enough, that justification involves a reference to published comments by Gruber.

The result of this specificity is a lengthy document (well over 10,000 words, according to one count). Apart from the effort to disambiguate the existing Markdown standard, there are few changes to be found in this initial version of CommonMark. Some of the most often-used features of site-specific Markdown variants are included, such as leaving underscores within words untouched, the ability to choose a starting number for numbered lists, and the ability to escape any punctuation character with a backslash. Other popular variations are not included, though, such as automatically creating hyperlinks on plain-text URLs.

MacFarlane notes that he has also introduced a new syntax for line breaks and fenced code blocks, because he felt these were "core" features left out of Gruber's description. Despite the paucity of changes against Gruber's Markdown, MacFarlane does leave the door open for further additions, such as footnotes and definition lists.

The reference implementations include a portable C99 library, a command-line Markdown-to-HTML converter called stmd, as well as two JavaScript converters (one meant to be linked into a page and one to be run with Node.js). All are BSD-licensed. The project's repository also includes a Perl script test utility that can be run against any Markdown interpreter. The test input for this program is intended to be the CommonMark specification document itself (which, needless to say, is written in CommonMark-compliant Markdown). Finally, the project has released an online test tool for experimenting with small Markdown snippets.

Where CommonMark will go from here remains to be seen, but the project's leaders are committed to incorporating feedback from the public at large. There is a Discourse discussion site running at talk.commonmark.org where interested parties can weigh in on the specification, ask questions, and suggest changes. In the eight days since its launch, several hundred comments have already been posted. Some ask for new features, some are concerned about complexity and convenience, while others have raised interesting meta-questions, like whether CommonMark should use its own file extension rather than Markdown's .md.

Certainly the rise of a vocal community is a good sign for the continued success of CommonMark. The trickier subject will be what would happen if CommonMark grows into a substantial challenge to Gruber's existing Markdown. A fork-and-re-merge in such situations has happened in the past, but there is no guarantee that the original Markdown will fade out or adapt, just because a popular new variant has emerged.


to post comments

A common Markdown

Posted Sep 10, 2014 22:15 UTC (Wed) by brendanlong (guest, #86273) [Link] (25 responses)

> Gruber's apparent hostility to the notion of others contributing to the further development of Markdown is, at least in Atwood's view, not a new position. In 2009, Atwood had commented on Gruber's disinterest in making updates to Markdown, citing his "passive-aggressive interaction" with the user community as a persistent problem. It could certainly be argued that some of Atwood's comments about Gruber, particularly in 2009, exhibited a fair amount of rancor as well, but at least the public messaging about the launch of CommonMark has been almost entirely free of personal criticisms about Gruber. That may not be sufficient to earn Gruber's blessing, but the project appears to be more focused on attracting the input of other Markdown users than on winning over the format's original creator.

I think part of why Gruber is as so annoyed is that Atwood is making it look like he's neglecting the project, when the reality is that he just doesn't want to add anything else to it. Is it really that unreasonable for someone to decide, "This is what Markdown is, I will not be adding any new features"? It's not like Markdown is the first project with a "benevolent dictator". The fact that a lot of people disagree with his position indicates that a fork like CommonMark is a good idea, but it's weird how everyone seems to think that Atwood has a right to take the name Markdown and make it mean something different (keep in mind, CommonMark doesn't just remove ambiguity, it also intentionally violates significant portions of the spec).

A common Markdown

Posted Sep 10, 2014 22:41 UTC (Wed) by SLi (subscriber, #53131) [Link] (17 responses)

There are already like 15 incompatible Markdowns. That horse is out of the barn. It's too late to protect the name now against the one you disagree with.

A common Markdown

Posted Sep 10, 2014 22:53 UTC (Wed) by brendanlong (guest, #86273) [Link] (3 responses)

Don't make the assumption that I *like* standard Markdown. I'm just saying that just because Atwood's version is better doesn't give him a right to the name.

Like how if I decided that I don't like something about Linux, and how all of the Linuxes are incompatible, so I'll make my own kernel and call it Standard Linux. It doesn't matter if it's better, it still doesn't make sense to try to take the name.

A common Markdown

Posted Sep 10, 2014 23:14 UTC (Wed) by neilbrown (subscriber, #359) [Link] (2 responses)

> it still doesn't make sense to try to take the name.

that would be because the LMI actively defends use of the "Linux" mark and would probably disallow it, and at least require a license fee.

Has the name "Markdown" been actively defended? I guess not.

Is "vanilla markdown" just as unjustified by your metric as "standard markdown"? If so, then vfmd.org should not exist.

(is it time for lwn comments to have a third "Format:" option: CommonMark??)

A common Markdown

Posted Sep 11, 2014 14:33 UTC (Thu) by brendanlong (guest, #86273) [Link] (1 responses)

> Has the name "Markdown" been actively defended? I guess not.

Yes, John Gruber is actively defending the name. That's why this controversy exists at all. Has he sued anyone? Not that I know of. But like I said before, why does the legal situation matter at all? Are we mindless beasts who can't be courteous without police officers determining what names we can use?

A common Markdown

Posted Sep 12, 2014 14:46 UTC (Fri) by louie (guest, #3285) [Link]

He's never defended in *any* sense, not just legal. There is Github Markdown and, well, a bazillion other variants, all called Markdown. That has been going on for years, but this is the first one that he has snarked about publicly (that I know of).

(My sympathy with Gruber here is roughly zero. The mumbledygook that it doesn't matter if the spec is underspecified, because somehow that benefits writers, is just incomprehensible.)

A common Markdown

Posted Sep 10, 2014 22:57 UTC (Wed) by creemj (subscriber, #56061) [Link] (11 responses)

Does Gruber hold a trademark on "Markdown"? If not, then I don't see how he can require the new guys to change the name. Gruber may well hold copyright on his expression of "Markdown", but that is irrelevant here. If he holds neither a trademark on "Markdown", nor a patent on a simplified means of entering HTML markup, then I don't see any basis (other than an obnoxious attitude) for his complaints, and I do not understand why the new guys should be apologising for using the name "Markdown".

A common Markdown

Posted Sep 10, 2014 23:03 UTC (Wed) by brendanlong (guest, #86273) [Link] (10 responses)

Why conflate laws with what's right? Gruber clearly *could* get a trademark on Markdown. Whether he wants to use the government to violently prevent people from using the word is irrelevant. It seems like it's just common courtesy to come up with a new name when you come up with a new thing. There's a potential for confusion when people see Markdown vs. Standard Markdown and assume the second one is the original (and this is still confusing, with CommonMark using a logo which clearly reads "M-Down").

A common Markdown

Posted Sep 10, 2014 23:48 UTC (Wed) by creemj (subscriber, #56061) [Link] (2 responses)

Did Atwood et al. use code from Gruber? I had assumed that they did not, and if that is the case then there is no courtesy whatsoever to be extended except to acknowledge Gruber as the originator of the idea of markdown.
If, however, Atwood et al. did use code from Gruber there could be a requirement for them to use a new name if the copyright places such a burden on them. (And my statement in a comment above that copyright is irrelevant would not be correct.)

A common Markdown

Posted Sep 11, 2014 14:38 UTC (Thu) by brendanlong (guest, #86273) [Link] (1 responses)

You're mixing up copyright with trademarks.

A common Markdown

Posted Sep 12, 2014 9:10 UTC (Fri) by creemj (subscriber, #56061) [Link]

Bollocks.

In what way am I mixing up copyright and trademarks? My understanding is:

A trademark is the right to the exclusive use of a mark, logo, small phrase/word, for the purposes of identifying products in a limited area of trade, so that customers can identify the products of a company without confusion.

Copyright provides certain monopoly rights to owners to limit the copying and trade of a creative work by others for a limited time (unfortunately the USA seems to have lost sight of that 'limited time' bit), in an incentive to the content creator to produce more creative works which ultimately benefits the public. Note that copyright cannot be held on ideas, thus, for example, there is no copyright on the idea of "Markdown". Some countries (not the USA) legislate "moral rights" (such as the moral right to be identified as the author/composer/creator of a work) in addition to copyright and these moral rights cannot be transferred or sold to another person/organisation.

A common Markdown

Posted Sep 11, 2014 4:02 UTC (Thu) by dlang (guest, #313) [Link] (1 responses)

> Gruber clearly *could* get a trademark on Markdown.

I don't think it's that clear.

He could apply for it, but the fact that he has allowed many different people to use the term for incompatible implementations for years would be a big strike against him.

Remember the Kleenex lesson, just using a term isn't enough, you have to defend it and prevent it from becoming generic. With 22 incompatible implementations, there's a fair case to be made that that point has already been passed.

And if he were to go after the current users of markdown, they would vote with their feet and CommonMark would become the new standard in days to weeks (especially if the CommonMark people were sane an allowed a grace period where they called it CommonMark like as they convert)

> There's a potential for confusion when people see Markdown vs. Standard Markdown

and how much more confusion is possible when there are 22 different things all called just "Markdown"?

A common Markdown

Posted Sep 11, 2014 14:34 UTC (Thu) by brendanlong (guest, #86273) [Link]

> And if he were to go after the current users of markdown, they would vote with their feet and CommonMark would become the new standard in days to weeks (especially if the CommonMark people were sane an allowed a grace period where they called it CommonMark like as they convert)

I would be entirely in favor of this.

> and how much more confusion is possible when there are 22 different things all called just "Markdown"?

None of the others tried to make themselves sound the The One True Markdown. Look at Gruber's comments, where he clearly doesn't have a problem with names like "GitHub-flavored Markdown" because they're not trying to claim official status.

A common Markdown

Posted Sep 11, 2014 16:32 UTC (Thu) by SLi (subscriber, #53131) [Link] (4 responses)

Even as a matter of courtesy, I'd argue you are wrong. Trademark law serves as a useful explanation here, though.

The fact that you need to defend trademarks is not just some quirk of law; it's because that's the right way for things to be. Consider for example bandaid (which used to be a trademark). You can choose to *either* let the trademark become generic, in which case it becomes much more known but you lose your right to demand others to not use it, or you can choose to defend it. Once "bandaid" is associated with the generic item, not the specific product from the specific company, it would give unfair advantage to allow the company to grab that name back.

The same has happened with Markdown. There are 15 different flavors of markdown. Standard Markdown is just a flavor of markdown, just like Github markdown is a markdown. The name is descriptive, and it's useful because it is descriptive.

Now that Gruber has let this term become generic (and much more known - it would be quite obscure if he had prevented anyone from calling anything but his official software Markdown), it would be profoundly unfair to let him grab the word and claim some kind of exclusivity for it. Such protection flows no more from common ethics than from trademark law.

A common Markdown

Posted Sep 14, 2014 0:08 UTC (Sun) by martinfick (subscriber, #4455) [Link]

Wow, this comment was very insightful, thank you!

A common Markdown

Posted Sep 15, 2014 1:51 UTC (Mon) by dlang (guest, #313) [Link] (1 responses)

It's worth noting that Xerox went the other direction than Band-aid. They got very aggressive about scolding people who used 'Xerox" instead of "photocopy" (lots of legal threats to any movie/TV show that used the term and then didn't show a Xerox brand copier). they kept the trademark, but got a reputation as a company that was lawsuit happy and ended up loosing what was once a very dominant market share.

It's hard to say how much this negative campaign cost them, but it did eat up a significant amount of money and attention from the company, even if you discount the negative associations that it caused with potential customers.

A common Markdown

Posted Sep 16, 2014 20:48 UTC (Tue) by jwarnica (subscriber, #27492) [Link]

I'm not sure the timeline, but Xerox would be an interesting exploration if it added other factors I'm aware of:

- The science is xerography, which leads directly to the name of the company
- But it took like 20 years from the laboratory curiosity to become a product
- Leaving little time between actual customers having a product, the company having income from that product, and the patents expiring and them having competition
- But it was long enough for them to get used to having zero competition; they were a disruptive technology
- Their competitors disrupted them (actually sold hardware, not leased things), cheaper, better, faster, and the dominant and cash strong company responded like responsible leaders do: buy suing everyone they could think of, and ignoring their blank-cheque research divisions artifacts

Its an interesting story.

A common Markdown

Posted Sep 24, 2014 14:26 UTC (Wed) by nye (guest, #51576) [Link]

>Consider for example bandaid (which used to be a trademark)

And still is.

A common Markdown

Posted Sep 14, 2014 7:39 UTC (Sun) by jond (subscriber, #37669) [Link]

I generally think that Standard/Common Markdown is a good idea, but this "15 different ways" thing is very misleading. If you look at the output, IMHO most of them are quite simply wrong, so that's buggy software rather than ambiguous spec, and some people are using the "15 different ways" fact disingenuously.

A common Markdown

Posted Sep 10, 2014 23:01 UTC (Wed) by joey (guest, #328) [Link] (3 responses)

The genius of markdown is that it takes the best practices built up over decades for formatting plain-text emails (and usenet etc) and maps them to html for display.

The few places it strays from or adds to those practices seem to be the least successful. These include the [link](url) syntax, complicated nested lists/blocks, and needing to escape underscores that are not used for _emphasis_.

Which all makes me wary of standardization attempts that go beyond bugfixes. It seems it would be easy for a standards body to lose sight of the internet-geologic processes that sculpted out the terrain for which markdown is a map, and move it in a direction that diverges from what it's supposed to be. Standards bodies also don't tend to produce intuitive documentation for users, and what I've read of this one so far is well in that tradition.

At the same time, I don't appreciate Grubor's neglect of markdown. I suspect he could have dealt with a few bugs (like over-eager underscore/asterisk emphasis) early on, and down a better job with the reference implementation, and avoided most of the fragmentation. Or just found a good caretaker to do those things when the Apple shiny got too attractive.

A common Markdown

Posted Sep 11, 2014 1:17 UTC (Thu) by amk (subscriber, #19) [Link] (2 responses)

This is the cycle of life for simplified markup formats. Someone says HTML, POD, or reStructured Text are too complicated: "let's just use *bold* and /italic/ instead." But then you want headings, lists, external links and then internal links, different shades of semantic markup... Now the markup format is more complicated, parsers take more effort to write than just a simple regex loop, and people again start thinking "let's just use *bold* and /italic/."

A common Markdown

Posted Sep 11, 2014 4:51 UTC (Thu) by neilbrown (subscriber, #359) [Link]

Maybe it is time to break the cycle...

Parser complexity really isn't an issue. This is a point that John Gruber makes and I haven't heard anyone disagree with. The big point of markdown it to make it easy to author text - markdown does that very well. It also doesn't *need* to be extended. You can use HTML for any construct that Markdown doesn't provide. The whole process is still easier than writing pure HTML, even if it isn't as easy as you would like.

The GP says:

> Which all makes me wary of standardization attempts that go beyond bugfixes.

I think there is little need to be wary of CommonMark then - it doesn't go much beyond bugfixes. There are only two extension (soft line breaks and fences code blocks), and both of those are apparently seen by MacFarlane as bug fixes (though I do have trouble with spaces at the end of a line not being ignored...)

The core principle of Markdown seems to be that it should be easy to write and natural to read. If we stick to that and say "no, use HTML fragments" to any proposal that isn't easy to write and natural to read, then there should not be a need for "it's too complex, let's start again from scratch".

A common Markdown

Posted Sep 11, 2014 17:52 UTC (Thu) by jhoblitt (subscriber, #77733) [Link]

Speaking as a *heavy* /user/ of markdown, I don't care how complicated it is to parse and my only concerned about parse and html generation speed is that it's not horribly egregious. What I *do care about* is simple, consistent and non-intrusive technical document authoring.

While markdown has been a "great leap forward" for many uses, you presently have to suffer with irritating incompatibilities between implementations even around trivial whitespace. Adding complexity to the specification to /remove ambiguity/ in behavior is a /service to the end user/.

A common Markdown

Posted Sep 10, 2014 23:20 UTC (Wed) by flussence (guest, #85566) [Link] (2 responses)

> Is it really that unreasonable for someone to decide, "This is what Markdown is, I will not be adding any new features"?

Not at all. But it would have been nice if Gruber had extended to everyone the minimal courtesy of coming out and *saying* that.

What he did instead was to lead with a mixture of apathy and snark, ignore the project for two years, and then reward their completed work with repeated takedown demands over the name.

I suppose he's well within his rights to do so, since the project uses a BSD license with the advertising clause. Before that it was available under GPLv2:

http://web.archive.org/web/20041207052059/http://daringfi...

If the other side were so inclined, they could've forked that GPLed version and told him to take a hike. Instead they've gone far out of their way to be professional, transparent, and accommodating to all his demands.

I don't have much sympathy for the guy after all this, personally.

A common Markdown

Posted Sep 11, 2014 0:16 UTC (Thu) by mrshiny (guest, #4266) [Link]

Does Gruber's choice of software license really factor into it, though? Gruber is complaining about the name. That would appear to be a trademark issue, and frankly when you're talking about language names, the trademark gets fuzzy. Does gcc implement "C" or "Common-see"? Does Android use "Java" or "coffee"? Does "CoffeeScript" infringe on "Javascript"? Do Brazilians speak Portuguese or Brazilian? Etc.

The name of a language describes the protocol of data exchange, it doesn't necessarily represent a "trademark". Therefore it's not clear that Gruber has a leg to stand on here. Personally I find it extremely annoying that the de facto standard "Markdown" isn't called any kind of "Markdown".

A common Markdown

Posted Sep 11, 2014 1:53 UTC (Thu) by spaetz (guest, #32870) [Link]

GPL doesn't give you the right to the name/trademark. Otherwise CentOS would not be called CentOS.

A common Markdown

Posted Sep 11, 2014 8:14 UTC (Thu) by aleXXX (subscriber, #2742) [Link]

Nice, together with a C library ! :-)

I had searched for a C/C++ library for markdown-to-html conversion last year and didn't find one.

A common Markdown

Posted Sep 11, 2014 8:58 UTC (Thu) by cuboci (subscriber, #9641) [Link] (6 responses)

I'm not the only one to think of this, am I?

http://xkcd.com/927/

A common Markdown

Posted Sep 11, 2014 13:53 UTC (Thu) by mpr22 (subscriber, #60784) [Link] (5 responses)

When the people creating the new thing are the maintainers of several of the old things whose replacement is proposed, you have a reasonable chance of avoiding the XKCD 927 scenario.

A common Markdown

Posted Sep 11, 2014 18:15 UTC (Thu) by smitty_one_each (subscriber, #28989) [Link]

Optimistic.

A common Markdown

Posted Sep 11, 2014 18:45 UTC (Thu) by ejr (subscriber, #51652) [Link] (1 responses)

See Wiki Creole for a counter-example. There were too many already installed wikis for global change, IMHO. I suspect the same thing will occur here.

A common Markdown

Posted Sep 18, 2014 7:10 UTC (Thu) by oblio (guest, #33465) [Link]

The major players are onboard: Reddit, Github, Stackexchange. They will probably be the first to convert and then the others will follow slowly.

Of course, sites which are not maintained will not follow suite. Let's not forget that the most popular mark up language for humans isn't going anywhere soon, and most people even forgot that it exists: BBCode.

A common Markdown

Posted Sep 15, 2014 19:16 UTC (Mon) by Baylink (guest, #755) [Link] (1 responses)

Does anyone know if Randall has noticed that XKCD has become a prefix equivalent in stature to RFC?

A common Markdown

Posted Sep 15, 2014 23:33 UTC (Mon) by dashesy (guest, #74652) [Link]

DDG does honor that just like RFC.

Some formalism is actually useful

Posted Sep 11, 2014 9:30 UTC (Thu) by Yorick (guest, #19241) [Link] (8 responses)

Probably not looking around well enough, but I couldn't find a formal grammar anywhere. Is there one?

Some formalism is actually useful

Posted Sep 11, 2014 10:15 UTC (Thu) by neilbrown (subscriber, #359) [Link] (7 responses)

What sort of form did you imagine this formal grammar might take? EBNF? Context Free Grammar?
If the latter you would need to tokenize it first and I don't think it is a language that tokenizes very well.
Indents are a bit awkward to deal with in those sorts of formalisms too...

Lots of other people on various fora have wanted a "formal grammar". I personally cannot imagine what that would look like, but I'm very open to be enlightened.

What formalism would you use?

Some formalism is actually useful

Posted Sep 11, 2014 13:11 UTC (Thu) by tialaramex (subscriber, #21167) [Link] (1 responses)

Although probably a "formal grammar" of the sort we might expect for a programming language is not to be expected, I think this document falls rather short of what you'd like to be confident ambiguities are eliminated, rather than merely reduced. Two very quick examples:

Throughout the document it talks about "characters". I think probably the most healthy interpretation would be to assume this means

(a) Like (modern) HTML Common Mark is defined over Unicode only, the actual text encoding being used (including ASCII or Windows-1252) is an implementation detail that should not affect the results

(b) "Character" is the document means a Unicode code point

- but it never says so, and perhaps it intends that a "Character" is a grapheme (the intuitive unit of written human text) which can correspond to less or more than one Unicode code point. Or some other interpretation entirely. Who knows?

In one place a vague reference is made to "Unicode case fold". In reality "case folding" even with Unicode is not a trivial matter and deserves at least a brief note as to what _specifically_ is intended.

Some formalism is actually useful

Posted Sep 12, 2014 11:16 UTC (Fri) by mbunkus (subscriber, #87248) [Link]

I highly suggest you make the CommonMark authors aware of your objections if you haven't done so already. They seem to be genuinely interested in feedback and incorporating suggestions, fixing issues in the spec etc. And I agree that the subject of character sets is something that deserves clarification.

Some formalism is actually useful

Posted Sep 11, 2014 14:22 UTC (Thu) by epa (subscriber, #39769) [Link] (2 responses)

Hacking up a grammar can be a useful exercise, even if it's not eventually included in the spec. A good parser generator like Marpa can show you all possible parses of a document, if the grammar is ambiguous. This could provide some insight into corner cases. As you say, it would have to be a grammar that operates directly on input characters, without an initial tokenization step.

Some formalism is actually useful

Posted Sep 12, 2014 9:46 UTC (Fri) by epa (subscriber, #39769) [Link] (1 responses)

Indeed, here is a Marpa-based parser for CommonMark: https://github.com/rns/MarpaX-Languages-CommonMark-AST

Some formalism is actually useful

Posted Sep 15, 2014 4:13 UTC (Mon) by neilbrown (subscriber, #359) [Link]

> here is a Marpa-based parser for CommonMark

Interesting project - thanks for the link!

Some formalism is actually useful

Posted Sep 12, 2014 1:25 UTC (Fri) by gdt (guest, #6284) [Link] (1 responses)

Agree that a formal grammar would force issues such as "what is a token". We differ in seeing that as a poor thing. It would also flush out if this language can be parsed by a LR(k) parser, which is an important point when determining what tools can be used to parse the text. A statement of the minimal parser required would guide implementers away from impossible tools (eg, a LL(1) parser is not going to work).

Any formalism suitable for the type of parser required is fine. If you stay within the one type of parser (LL(1), LR(1), LR(k), etc) then the formalisms are interchangeable. Use whichever brings the most clarity.

Some formalism is actually useful

Posted Sep 12, 2014 16:58 UTC (Fri) by Yorick (guest, #19241) [Link]

I was going to reply to Neil Brown but your reply just about covers it all – thank you!

The only think I'd like to add is that a formal semantics would not be out of the question either. After all, this is not even a programming language but something much simpler; it's mostly a fairly straightforward text transformation.

The reasoning is exactly the same as for the syntax: it forces authors to think everything through properly, and it removes the last traces of ambiguity.

A common Markdown

Posted Sep 12, 2014 16:28 UTC (Fri) by dag- (guest, #30207) [Link] (21 responses)

I am very fond of AsciiDoc, as the syntax is closer to what one would assume. But also because it implements Simplified DocBook almost 1:1 and is therefore much more suited for documentation purposes.

For instance, this is how you would do *bold*, _emphasized_ or +monospaced+, but there's also room for references, images, listing/literal/sidebar/quote/example/comment/code blocks, tables, labeled lists, footnotes, etc.

You can also include other files, or embed other sources, making it perfect for larger works. Many O'Reilly authors these days use AsciiDoc for writing books.

A common Markdown

Posted Sep 12, 2014 17:33 UTC (Fri) by lambda (subscriber, #40735) [Link] (20 responses)

I just wish we could settle on fewer lightweight markup formats.

As it is, I use Markdown (Reddit, StackOverflow), ReStructuredText (Python documentation), Textile (Redmine), and MediaWiki (Wikipedia and other wikis I'm involved in) syntax on a fairly regular basis, and AsciiDoc and other various wiki syntaxes on a somewhat less regular basis. So I constantly have to remember "is italic *foo*, _foo_, or ''foo''? Is monospace `foo`, @foo@, or +foo+? How do I format an ordered list; do I use #, 1., or is it just impossible in this format? How about a nested list?

And then it doesn't help when within a given format, there are a dozen implementations all with slightly different results. I am glad for the CommonMark effort, and I hope that maybe it can mean that various Markdown implementations get more consistent. But I really wish people would stop inventing new lightweight markup languages and just start converging on one.

A common Markdown

Posted Sep 12, 2014 23:03 UTC (Fri) by dag- (guest, #30207) [Link]

Well, AsciiDoc was not recently invented, it predates MarkDown with a few years. (2002 vs 2004) And AsciiDoc was more feature-complete than MarkDown still is today thanks to its ties to DocBook.

A common Markdown

Posted Sep 13, 2014 5:51 UTC (Sat) by patrick_g (subscriber, #44470) [Link]

> I just wish we could settle on fewer lightweight markup formats.

I never understood why the world have not opted for txt2tags. It predates Markdown or AsciiDoc and the syntax is IMHO simpler and more consistent.

A common Markdown

Posted Sep 13, 2014 15:00 UTC (Sat) by epa (subscriber, #39769) [Link] (17 responses)

I just wish that sites would pick some subset of HTML, describe it to the browser (as a DTD or whatever), and then the browser lets the user enter HTML with whatever editing interface is most convenient.

The early browser-cum-editors (Netscape being the most prominent example) have fallen by the wayside because of the increasing complexity of HTML and the fact that for making a website a specialized editor is better. But a simple, lightweight HTML composer for just the core part of the language (no Javascript, CSS, frames etc) seems like a much more appropriate thing to have in a web browser than a PDF viewer, video player etc.

I suppose what we may get instead one day is a Commonmark editor implemented in Javascript to run in the browser...

A common Markdown

Posted Sep 13, 2014 22:07 UTC (Sat) by mpr22 (subscriber, #60784) [Link] (16 responses)

I type pretty fast, and I have a good grip on basic HTML, and I still greatly prefer something like Markdown for any task that doesn't actually need full-bore HTML support, because I prefer typing two extra characters to mark a section of text as emphasized (the single most common thing I use markup for) instead of nine.

A common Markdown

Posted Sep 14, 2014 7:09 UTC (Sun) by epa (subscriber, #39769) [Link] (15 responses)

To be clear, I am not suggesting that the user have to type in raw HTML code. That's a non-starter, especially for less technical users. I am saying that the browser provide whatever HTML editing interface is most convenient.

I imagine that usually this would be similar to the existing textarea control, with toolbar buttons for bold, italic, preformatted, and so on. It could even be done with Markdown if that is what users prefer - but the document sent back from the browser to the site is standard HTML conforming to some subset of the HTML standard the site has declared.

A common Markdown

Posted Sep 14, 2014 8:57 UTC (Sun) by mbunkus (subscriber, #87248) [Link] (14 responses)

One big advantage of something as simple as CommonMark is that you can type very fast including markup without taking your fingers off your keyboard. With HTML you have several options, all of which are way worse:

1. Type HTML tags manually; as mpr22 has said this is way more verbose
2. Use the mouse for marking text and pressing a GUI button for markup which requires switching between mouse and keyboard, and it disrupts your flow and often your train of thought,
3. If the editor supports keyboard shortcuts then you need to type your text first, then select the appropriate portion and hit that shortcut, again disrupting your flow and train of thought.

Being able to /type/ really fast with `little` thought to markup and without *disrupting* everything is, in my book, on of the greatest _advantages_ of such simple markup languages.

A common Markdown

Posted Sep 14, 2014 10:10 UTC (Sun) by mathstuf (subscriber, #69389) [Link] (1 responses)

There's a tool called sparkup[1] which I've found very useful for editing HTML directly.

[1]https://github.com/rstacruz/sparkup

A common Markdown

Posted Sep 14, 2014 10:19 UTC (Sun) by mbunkus (subscriber, #87248) [Link]

Interesting, but the problem with any text editor enhancement is that you need a supported text editor. If you don't you miss out on the functionality. If the underlying language is simple itself already then the editor in question doesn't really matter. And we all know how… protective we all are regarding that our favorite editor ;)

A common Markdown

Posted Sep 15, 2014 11:22 UTC (Mon) by epa (subscriber, #39769) [Link]

Yes, that's great (though perhaps not for the lower 50% of less technical users, who nonetheless might want to add bold and italics to what they write). I am not suggesting to stop authoring in CommonMark or whatever markup scheme you prefer. In fact, my proposal makes it more possible.

Think about it: at present, each website has its own peculiar not-quite-HTML, not-quite-plain-text markup language (even despite standardization efforts like Markdown). You have to learn that and enter it in a plain textarea control; the browser gives you no help and to preview the results you must hit Preview and do a round trip to the server.

Instead, the website would specify a subset of HTML it accepts; you can then compose that HTML in your browser using whatever editing interface is convenient *to you*, rather than being stuck with what the website has chosen. Of course the browser can offer a CommonMark-based editing interface, with the advantage that the resulting HTML is previewed instantly, and any syntax errors in the markup (to the extent those can exist) are checked before the content is sent to the site. The markup language used would be the one you choose, so it would be the same across all sites (with the exception that if a site declares it doesn't support the HTML <I> element, italics wouldn't be available, and so on).

A common Markdown

Posted Sep 16, 2014 11:23 UTC (Tue) by robbe (guest, #16131) [Link] (10 responses)

> 3. If the editor supports keyboard shortcuts then you need to type your
> text first, then select the appropriate portion and hit that shortcut,
> again disrupting your flow and train of thought.

No, just hit the "start italic/bold/underlined text" shortcut, type your italic/bold/underlined content, then hit the same shortcut again. Not unlike those light-markup languages, in fact: just replace / * _ with Ctrl-I Ctrl-B and Ctrl-U.

Plus, for the basic stuff above, the shortcuts seem to be pretty universal, which is not true for markup langs.

A common Markdown

Posted Sep 16, 2014 13:35 UTC (Tue) by epa (subscriber, #39769) [Link] (9 responses)

Some word processor programs let you type *stuff* and convert it on the fly into italics, with similar shortcuts for bold and underline. Of course, there are many possible approaches here. The key is to disentangle two questions: (a) what is a convenient way for humans to compose fragments of HTML for inclusion in a Web page? (b) what is the best way for this HTML to be communicated from the browser to the site?

Just as nobody is expected to type in and escape form parameters by hand - the browser presents a friendly interface and handles the details for you - there should be a similar browser interface for editing HTML to submit to a site, automatically ensuring it complies with restrictions the site places (no <IMG> elements, etc etc).

A common Markdown

Posted Sep 16, 2014 14:20 UTC (Tue) by mpr22 (subscriber, #60784) [Link] (8 responses)

What do the people whose cooperation you need in order for this proposal to be useful actually gain from this proposal? It seems to me that the answer is "very little", because from the point of view of the server software developers and the server administrators, the user agent can't and mustn't be trusted to understand and honour the HTML submission restriction metadata, so transmitting that metadata in the first place doesn't seem to offer any real benefit.

Maybe I'm missing something. Perhaps you could point it out to me.

A common Markdown

Posted Sep 16, 2014 14:49 UTC (Tue) by nybble41 (subscriber, #55106) [Link]

> the user agent can't and mustn't be trusted to understand and honour the HTML submission restriction metadata, so transmitting that metadata in the first place doesn't seem to offer any real benefit

Presumably the benefit would be that the user agent could tailor the UI according to which elements are supported. E.g. if the server doesn't support images, the icon to insert them could be hidden or disabled. In that sense it serves the same purpose as any client-side validation. Naturally, the server will still need to validate the input after it's been submitted.

A common Markdown

Posted Sep 16, 2014 15:05 UTC (Tue) by epa (subscriber, #39769) [Link] (6 responses)

It's the same as client-side form validation to make sure that a 'date' field, for example, contains a valid date. Obviously the server has to check the submitted value anyway. But it is normally more convenient for the user if the entered date is validated on the client side first, so that any mistake can be corrected at once without a round trip to the server. Moreover, a friendly date picker widget can be shown if desired.

Similarly, when I am programming my IDE highlights syntax errors as I type. What is the point of this, when the compiler has to parse everything and report errors anyway? In many cases it saves a slow and somewhat clunky save-compile-review cycle.

I'd be happy enough to forgo the possibility that different sites could allow different subsets of HTML. Perhaps it would be good enough to define a single standard 'comment HTML' with the elements that may and may not appear (<BLOCKQUOTE>, yes; <TABLE>, no; etc). Then the browser's job would be only to provide a convenient editor for this HTML subset. But because it's a subset of HTML, all the awkward questions about how to format and display it, what the quoting rules are, etc. have already been addressed.

To me, that seems much preferable to a dumb textarea control (which knows nothing about the rules of Markdown, HTML, or anything else) and a round trip to the server each time you hit the Preview button to see what you typed.

Of course, whenever the browser is missing some functionality, you can work around it in Javascript. Sites such as Stack Overflow already have a real-time preview of your comment. But all the usual tradeoffs of Javascript versus builtin features apply; the Javascript-powered comment box with separate preview adapts less well to handheld devices, screen readers and so on. Better to have an HTML editor control provided directly in the browser, which knows best how to interact with the user and the constraints of the device it's running on.

A common Markdown

Posted Sep 16, 2014 15:20 UTC (Tue) by raven667 (subscriber, #5198) [Link] (5 responses)

> Of course, whenever the browser is missing some functionality, you can work around it in Javascript.

That is an interesting side conversation, that you can gauge what features might be useful to be standardized in a browser based on the popularity of JavaScript which implements the feature. Without a compelling case that the feature is widely deployed with JavaScript and that the browser could implement it better itself then maybe the feature really doesn't need to be there.

A common Markdown

Posted Sep 16, 2014 16:28 UTC (Tue) by epa (subscriber, #39769) [Link] (4 responses)

Agreed, that is often a useful rule - though I would expand it to cover things dealt with by old-style form submission as well as by Javascript. There are other 'sore points' in browser functionality which are often worked around by websites: authentication is the one which sticks out most. The browser's built-in authentication dialogue box is underpowered and too techie for most sites to use, even though there are advantages to using HTTP digest authentication (or whatever secure scheme you want to design) rather than typing passwords into webforms to set a cookie.

Another browser weakness is viewing images in multiple sizes, though that may start to be addressed with the new HTML <picture> element. (It was meant to be dealt with by HTTP headers, so a picture would have a single canonical URI and you'd request the size you wanted with headers, but that didn't work out.)

Note that my proposal is not just about having an extra browser feature, but also about standardizing HTML (or a well-defined subset thereof) as the markup language for comments when they are submitted from the browser to the server. So all the fights about the one true syntax for monospaced text become a matter of user preference: you can use whatever interface you prefer for composing HTML, which obviously includes the possibility to type in Markdown. The site doesn't have to care and doesn't have to run bizarre parsing code to convert from the not-quite-text format du jour into standard HTML, which is usually what was wanted all along.

A common Markdown

Posted Sep 16, 2014 21:01 UTC (Tue) by mathstuf (subscriber, #69389) [Link] (3 responses)

> (It was meant to be dealt with by HTTP headers, so a picture would have a single canonical URI and you'd request the size you wanted with headers, but that didn't work out.)

Good. I'd like to be able to hint to the web server with information I control rather than what the server thinks is best for me. Low bandwidth (or capped data plans) may change the "oh, 1080p? have a 50M image" logic and not having to wait for people to get off of ancient web servers to get this support is way better.

A common Markdown

Posted Sep 16, 2014 21:58 UTC (Tue) by epa (subscriber, #39769) [Link] (2 responses)

That's exactly it - you tell the server what image size you want and it serves back the request. That could be done in HTTP headers or it could be done in the URI, but either way you are dependent on the server to choose the content to serve.

I am perhaps going out on a limb to claim this is how images were 'supposed' to work, but a lot of the early web documentation talks about how to serve a document in different translations depending on HTTP headers, for example. The idea was that a URI identifies a particular 'resource', which is not to say that all requests for that resource get back an identical byte string. Image file formats themselves would not be part of the URI; instead the server would return the format understood by the client.

I have a lot of sympathy with this approach, but it takes some care to set up. Most of the time we prefer to treat URIs like filenames, identifying a particular document, rather than as 'resources'.

A common Markdown

Posted Sep 16, 2014 22:27 UTC (Tue) by raven667 (subscriber, #5198) [Link] (1 responses)

That probably goes a lot toward the development simplicity of just serving out a directory of files rather than having a separate config mapping abstract resources to filenames, to do it the way you described you'd need a "resources.http" metadata file or some such in each directory listing the files and a common kind of misconfiguration would be to forget to add a file to the list, which people would hate. Other systems would look more like wikis with all the metadata in databases even if the contents are files on a filesystem somewhere. I guess that was too much for early web development.

A common Markdown

Posted Sep 17, 2014 4:34 UTC (Wed) by dlang (guest, #313) [Link]

It's worth nothing that with the current trend to REST APIs we are actually getting back to something much closer to the original intent (yes, REST is supposed to have everything in the URL, but if you look at people implementing it, they really aren't)


Copyright © 2014, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds