[kramdown-users] block parsing not recursive?

Matt Neuburg matt at tidbits.com
Sun Aug 12 15:33:29 UTC 2012

I have complete HTML but I want to sweep through it with kramdown so that kramdown can apply smart quotes, turn underlines into <em>, turn [...](...) into <a>, and all that other cool stuff. I can't figure out how to do that. The stuff I try seems to be non-recursive; there are tags it doesn't touch.


s = <<END
<div markdown="1">
<p>This is a _great_ text</p>

p Kramdown::Document.new(s).to_html
# => "<div>\n  <p>This is a _great_ text</p>\n</div>\n"

Shouldn't markdown="1" work recursively downward, so that _great_ is parsed into <em>?


Okay, so let's try :parse_block_html instead:

s = <<END
<div markdown>
<p>This is a _great_ text</p>
<p>This is a _great_ text</p>

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.


matt neuburg, phd = matt at tidbits.com, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com

More information about the kramdown-users mailing list