[kramdown-users] kramdown table-making has gone completely insane
t_leitner at gmx.at
Thu Oct 14 14:53:58 EDT 2010
On 2010-10-14 17:24 +0700 Shawn Van Ittersum wrote:
> On Thu, 14 Oct 2010 08:30:14 +0200, Thomas Leitner wrote:
> > Your above idea will obviously not work correctly, for example:
> > This is a paragraph `with a lone backtick.
> > This is another paragraph with a` lone backtick.
> > The intention of the writer is clear: There are two paragraphs each
> > containing a backtick. Since there is only one backtick in each
> > paragraph, the writer correctly thought that he can escape it but he
> > does not have to - and chose the latter.
> But I would interpret it as a single paragraph block containing a
> multi-line code span. The failure to escape the backticks is not
> kramdown's problem to fix. I am strongly advocating that backticks
> are for code spans only, and they *must* be escaped if they are not
> intended to open code spans.
A paragraph in Markdown/kramdown is, by definition, separated from
other paragraphs by blank lines (or eventually some other block level
elements in kramdown). So there is no way the above example can be
interpreted as only one paragraph! And, as I said, the author did
nothing wrong in *not* escaping the backticks since only one backtick
is used in each paragraph (which is allowed by Markdown/kramdown).
If we follow your train of thought, then invalid (note that there
basically does not exist invalid markup in kramdown/Markdown since no
errors are produced) markup for any special character that is handled by
kramdown will run amok on texts.
> >> If someone puts a couple of unescaped backticks in the document,
> >> then there's going to be a huge code span. But that's what is
> >> supposed to happen. Backticks wrap code spans, pure and simple.
> >> If users don't want code spans, they should escape their backticks.
> > No, that's not supposed to happen since code span are span level
> > elements and cannot cross, per definition, the boundaries of block
> > level elements! And don't forget the rule about how markup in
> > Markdown/kramdown works: if something is marked up correctly (e.g.
> > two backticks in a paragraph delimiting a code span), it is
> > correctly parsed and used, otherwise (e.g. only one backtick) it is
> > output as is. So one does *not* have to escape a single backtick or
> > a single asterisk or a single opening bracket or ...
> Okay, but if a code span is opened on one line and closed several
> lines later, it is still contained inside one block. The so-called
> block boundaries (blank lines, etc.) inside the code span are
> irrelevant, because kramdown is supposed to be ignoring the contents
> of the code span.
No, it is not since paragraphs, as stated above, are *closed* by blank
lines. This is one of the most important features of the original
Markdown syntax! Since code *spans* are **span level elements** they
cannot cross block boundaries and therefore cannot contain block
As for the "ignoring the contents of the code spans": kramdown *is*
ignoring the contents of code spans, just look at the implementation
`lib/kramdown/converter/html.rb`). So please don't use this invalid
The fact is (and the problem which lead to this very thread) that the
current table syntax necessitates a syntax which sometimes produces not
wanted code spans. And this is not the failure of the code span
implementation but of the table syntax!
More information about the kramdown-users