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

Shawn Van Ittersum svicalifornia at gmail.com
Tue Oct 12 14:33:07 EDT 2010


On Tue, 12 Oct 2010 15:21:11 +0200, Thomas Leitner wrote:
> On 2010-10-12 19:48 +1100 Shawn Van Ittersum wrote:
>> Thomas, please know that I have tremendous respect for the very
>> powerful software you created.  However, your explanation of this
>> particular issue is bordering on ridiculous.  Any human reading that
>> example would interpret `||` as a code span, not as a table-cell
>> delimiter.  Regardless of the underlying implementation details,
>> kramdown's faulty interpretation of this code is a bug or design
>> flaw, not a feature.  `||` is a code span, and kramdown's failure to
>> recognize it as such doesn't change that fact.
> 
> Yes, you are right. Any human would probably see that but what about
> these examples:
> 
>     This is a *cell | with some | data* here and here*

*...* does not delimit a code span, thus kramdown is free to process the contents.

>     Of course, you`re good | You are not so good | You`re bad!!!

According to typographic standards, backticks (`) should never be used as apostrophes.  However, nested quotes make a similar case:

   "He said pointedly, `Well, | isn't this a pickle? | I admitted, `Yes, I'm afraid it is.'"

However, even in this example, I would interpret the contents of the backticks as a code span, *unless* they had been escaped with backslashes.

I still believe that code spans should be found and extracted first, before looking for table cell delimiters.

> In fact, the problem exists only because of how the table parser
> currently works (and, naturally, because the code span parser does
> *not* process the contents of code spans). As I said before I'm
> working on correcting the problem!

You can solve this by finding the code spans on each line and extracting them (replacing them with hash markers, as in the example GFM code I sent previously) before applying the other parsers, including the table cell parser.

Shawn


More information about the kramdown-users mailing list