[kramdown-users] [ANN] kramdown 0.9.0 released

Thomas Leitner t_leitner at gmx.at
Fri Jun 25 02:19:23 EDT 2010

> First, what is the intended behavior when feeding kramdown a 
> fully-structured HTML document containing <html>, <head>, <body>? In
> my tests, upon converting to kramdown, a 'markdown="1"' attribute was
> added to <body>, however, this was ignored when converting the
> document back to HTML. Even when adding 'markdown="1"' manually to
> the parent <html> node, conversion back to HTML failed (that is, no
> Markdown processing was performed at all inside the body).

It should output it in a hybrid format, i.e. converting everything
possible to kramdown and leaving the rest as HTML. I just ran a sample
HTML document through html-to-kramdown-to-html and it worked fine for
all things except the DOCTYPE - I have put this on my TODO list.

> Second, once I stripped the <html> and <body> boilerplate from the 
> document, conversion on Windows from HTML to kramdown succeeded, but 
> conversion back to HTML failed with this exception:
> C:\>kramdown test.kd > test.html
> c:/ruby/lib/ruby/gems/1.9.1/gems/kramdown-0.9.0/lib/kramdown/parser/kramdown.rb:206:in 
> `check': incompatible encoding regexp match (UTF-8 regexp with IBM437 
> string) (Encoding::CompatibilityError)

Hmm... I have to look at this, and probably generate some test cases
for checking encodings under Ruby 1.9. Could you send me the test.kd
document so that I can dig into it and find the offending regexp?

> Third, this is an old HTML document still using <b>bold</b> elements 
> rather than <strong>...</strong>. The <b>bold</b> elements were not 
> converted to **bold** Markdown. I think it should be safe to treat
> <b> as equivalent to <strong> for conversion purposes.

Yeah, I thought about this... but decided against it, can't remember
why. But it should probably be okay converting <b> and <i> to <strong>
and <em>.
> Fourth, I ran into a problem with a stand-alone <img/> element being 
> consumed by a subsequent paragraph. For instance, given HTML input:
>    <img src="foo.png" alt="foo" />
>    <p>bar</p>
> Conversion to kramdown produced:
>   ![foo](<foo.png>)
>   bar
> And conversion back to HTML resulted in the <img/> becoming a child
> of the <p>:
>    <p><img alt="foo" src="foo.png" />
>    bar</p>

The reason for this is that kramdown always treats <img> tags as span
level elements and never as block elements like in your example above.
So an image will always be wrapped in a paragraph!

Also that consecutive text and span tags inside a flow HTML element like
<div> will conceptually be wrapped in a paragraph!

-- Thomas

More information about the kramdown-users mailing list