[kramdown-users] kramdown table-making has gone completely insane

Thomas Leitner t_leitner at gmx.at
Thu Oct 14 02:30:14 EDT 2010

On 2010-10-14 03:15 +0700 Shawn Van Ittersum wrote:
> What about the possibility that automatic line-wrapping (as by mail
> agents) will break a code span across multiple lines?  Should it not
> still be considered a code span?  To fully support lazy indentation,
> code spans should be allowed to span multiple lines.

This is already allowed...
> And if so, then this example:
> >     This is *not* a code span, | it `continues on the
> >     second line and ends` here | some other text here
> is really like this:
> >     This is *not* a code span, | it `continues on the second line
> > and ends` here | some other text here
> which yields a table with one row, three cells, the middle of which
> contains a code span.

Yeah, but if you think a bit further the whole table syntax consists of
lines separated from other block level elements by blank lines (in most
cases). So if we follow your thoughts then each table could only have
one table row...

Most elements in kramdown work fine when wrapped, headers, fenced code
blocks and tables do not!

> This is really simple: regexp search the document for backtick pairs,
> and replace each pair's contents with a hash, GFM-style.  Then apply
> your other kramdown interpreters, line-by-line.  Then expand the
> hashes at the end.

Really simple? Just look at all the Markdown processors that use the
hash-extract-replace mechanism... They all have serious problems when
it comes down to produce valid HTML (although, one has to say, they are
perfectly compatible to Markdown.pl since Markdown.pl also uses this

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.
> 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 ...

-- Thomas

More information about the kramdown-users mailing list