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

Thomas Leitner t_leitner at gmx.at
Mon Oct 11 03:43:58 EDT 2010

On 2010-10-10 08:34 -0700 Matt Neuburg wrote:
> require 'kramdown'
> s = <<END
> The operator `||` is called logical-or.
> puts Kramdown::Document.new(s).to_html

This is now converted to a table since the table syntax has been
adjusted to be more flexible and more compatible with the PHP Markdown
Extra tables.

The difference to the prior table syntax is basically that 

* tables must now start and stop on [block boundaries][1]
* *any* line that contains an unescaped pipe is potentially a table
  line, not only lines starting with a pipe

So since the above example consists only of one line, the block
boundary condition is met and since it contains unescaped pipes, the
other condition is also met. Note that you always needed to escape
pipes, even in code spans, which was the case even with the prior table

To tell kramdown to treat the line as a simple paragraph, you can do

    The operator `\|\|` is called logical-or.

This will give you a paragraph instead of a table.

> What I get:
> <table>
>   <tbody>
>     <tr>
>       <td>The operator `</td>
>       <td>&nbsp;</td>
>       <td>` is called logical-or.</td>
>     </tr>
>   </tbody>
> </table>
> There are actually two errors here. One is that &nbsp; must never be
> emitted, since I am using kramdown in an XSLT-processing context and
> &nbsp; is not a legal XML entity. Asking for :numeric output of
> entities makes no difference.

The entity `&nbsp;` is a valid HTML and XHTML entity, so outputting it
in the HTML converter is certainly okay. However, you are right that
the `entity_output` option should be respected, so this is a bug - I
have added this to my TODO list!
> Workarounds: none found! I can't think what to do aside from trying to
> revert to an earlier version of kramdown. m.

As stated above you need to escape the pipes for the line to be
treated as a paragraph.

-- Thomas 

[1]: http://kramdown.rubyforge.org/syntax.html#block-boundaries

More information about the kramdown-users mailing list