[kramdown-users] 0.11 bug (feature?) with <pre>-in-<dd> parsing

Piotr Szotkowski chastell at chastell.net
Mon Nov 1 09:39:06 EDT 2010


I found out that the following Markdown
is parsed differently by 0.10 and 0.12:

foo
: <pre class='bar'>baz { |qux| quux }</pre>

After some testing it seems it was introduced in
5354385d6bec8c89e4d8c2c2b76f6d07433800c7 and can
be side-steped by escaping pipes:



chastell at devielle:~/coding/kramdown$ git checkout fb3b6e514fc60d24973f070148bfd7d384bfc5d9
HEAD is now at fb3b6e5... Updated release notes

chastell at devielle:~/coding/kramdown$ echo -e "foo\n: <pre class='bar'>baz { |qux| quux }</pre>" | ruby -Ilib bin/kramdown 
<dl>
  <dt>foo</dt>
  <dd>
    <pre class="bar">baz { |qux| quux }</pre>
  </dd>
</dl>

chastell at devielle:~/coding/kramdown$ git checkout 5354385d6bec8c89e4d8c2c2b76f6d07433800c7
Previous HEAD position was fb3b6e5... Updated release notes
HEAD is now at 5354385... Updated table syntax to allow table lines without leading pipe characters

chastell at devielle:~/coding/kramdown$ echo -e "foo\n: <pre class='bar'>baz { |qux| quux }</pre>" | ruby -Ilib bin/kramdown 
<dl>
  <dt>foo</dt>
  <dd>
    <table>
      <tbody>
        <tr>
          <td>&lt;pre class='bar'&gt;baz {</td>
          <td>qux</td>
          <td>quux }&lt;/pre&gt;</td>
        </tr>
      </tbody>
    </table>
  </dd>
</dl>
Warning: Found block HTML tag 'pre' in span level text
Warning: Found invalidly used HTML closing tag for 'pre'

chastell at devielle:~/coding/kramdown$ echo -e "foo\n: <pre class='bar'>baz { \|qux\| quux }</pre>" | ruby -Ilib bin/kramdown 
<dl>
  <dt>foo</dt>
  <dd>
    <pre class="bar">baz { \|qux\| quux }</pre>
  </dd>
</dl>

chastell at devielle:~/coding/kramdown$ git log -1 5354385d6bec8c89e4d8c2c2b76f6d07433800c7
commit 5354385d6bec8c89e4d8c2c2b76f6d07433800c7
Author: Thomas Leitner <t_leitner at gmx.at>
Date:   Fri Sep 24 10:04:30 2010 +0200

    Updated table syntax to allow table lines without leading pipe characters
    
    This allows kramdown to correctly parse PHP Markdown Extra tables.



Is this a bug, or should I just escape
all my non-table pipes inside : lines?


— Piotr Szotkowski
-- 
The English language was carefully, carefully cobbled
together by three blind dudes and a German dictionary.
                                        [Dave Kellett]



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://rubyforge.org/pipermail/kramdown-users/attachments/20101101/0e59fa82/attachment.bin>


More information about the kramdown-users mailing list