Inline HTML legalities
arno at alum.wpi.edu
Wed Nov 30 10:02:19 EST 2011
On Wed, Nov 30, 2011 at 09:27, Andy Bennett <andyjpb at ashurst.eu.org> wrote:
> What is the correct way to parse these examples? Should I aim to produce
> the same output as the Perl implementation in all cases?
You've discovered the first and second rules of creating your own
Markdown implementation: there isn't a singular standard or correct
implementation. Every implementation differs from every other
implementation in some way. They resolve the edge cases and bugs in
different ways and they add new, sometimes conflicting features (i.e.
table or footnote implementations) and parsing methods.
And Markdown as an idea, I think, is far past the point of achieving
such a standard. Individuals have taken the task of creating
structured, unambiguous grammars, but there are too many
implementations that wouldn't fit or would be broken to adopt a single
grammar. Plus, consolidating everything would be impossible due to
The "correct" way to parse the given examples is essentially however
you want them to be parsed. Make a decision about how you think it
should be done or how you think your users will want it to behave.
Document that decision; try to be consistent.
It _may_ be easier to just handle the necessary escapes from within
your parser. That could also give you the option of changing Markdown
implementations as desired.
arno s hautala /-| arno at alum.wpi.edu
More information about the Markdown-Discuss