doesn't that make you wonder?
medusis at gmail.com
Wed Oct 19 06:04:13 EDT 2011
2011/10/18 John MacFarlane <jgm at berkeley.edu>:
> I made the case long ago that there should be a formal grammar for
> markdown, but the idea was never popular on this list. I wrote
> peg-markdown and lunamark to show that a formal specification was
> possible. Not everyone will agree with the way these grammars resolve
> ambiguities in the spec. And some may think that instead of a formal
> grammar, we need an official parsing algorithm (such as HTML 5 has).
> But until there is some kind of agreed-upon formal specification,
> implementations will inevitably diverge, even on "core" syntax.
Thanks for this detailed answer.
There are two solutions to this problem: the "official" one (either an
official spec or even a reference implementation) or the "de facto"
one (a specific implementation that "wins").
The official approach needs authority to establish itself, which is
difficult to find; since Gruber himself [does not really seem to
it's unclear where this authority could come from (consensus is a poor
substitute for authority).
But it's also not certain that the official approach would solve all
problems. The first example you gave (*test **test* test**) is
"invalid Markdown" and a formal specification could very well decide
that implementations are free to deal with invalid input any way they
choose (either by trying to fix it silently, in some way or another*,
or by raising an error).
And so it's possible that the best course of action is to wait for a
specific implementation to gain so much traction that every other
implementation that doesn't behave in the same way, looks broken.
In the meantime, maybe tools should advertise more clearly what
underlying implementation they rely on, and implementations
themselves, somehow document their behavior on all ambiguous
points...? Does a list of those ambiguities even exist?
*: why not <em>test </em><strong><em>test</em> test</strong> for example?
More information about the Markdown-Discuss