[kramdown-users] block parsing not recursive?
Thomas Leitner
t_leitner at gmx.at
Mon Aug 27 20:15:42 UTC 2012
On 2012-08-12 08:33 -0700 Matt Neuburg wrote:
> Shouldn't markdown="1" work recursively downward, so that _great_ is
> parsed into <em>?
No, the markdown attribute is only applied to the content of the tag
itself, not to other HTML tags found within.
> (2)
>
> Okay, so let's try :parse_block_html instead:
>
> s = <<END
> <div markdown>
> <p>This is a _great_ text</p>
> <table>
> <p>This is a _great_ text</p>
> </table>
> </div>
> END
>
> p Kramdown::Document.new(s, :parse_block_html => true).to_html
> # => "<div>\n <p>This is a <em>great</em> text</p>\n
> <table>\n<p>This is a _great_ text</p>\n</table>\n</div>\n"
>
> So now we do recurse down into the first <p> tag. But what's up with
> the <table> tag? It seems to block recursion down.
It works fine if you use <div> instead of <table>. This is because the
HTML content model for <table> is 'raw' whereas for <div> it is 'block'
- raw content is not parsed any further but block content is.
This is done because the <table> element cannot contain kramdown block
or span elements.
Best regards,
Thomas
More information about the kramdown-users
mailing list