[kramdown-users] possible bug: kramdown wrapping <br> in <p>

Thomas Leitner t_leitner at gmx.at
Thu Aug 12 05:57:42 EDT 2010

On 2010-08-11 08:37 -0700 Matt Neuburg wrote:
> Actually, now that I am a firm and enthusiastic convert to kramdown, I
> believe (thanks to Thomas's hint) that I understand kramdown's
> behavior here, and can defend it.
> <SNIP />

Your explanation is completely right, kramdown does it exactly in this

> If I am serious about protecting the "<br />", I have ways to do it.
> I can surround the entire document with a <div> and just isolate the
> sections to be processed with an inner <div markdown="1">. Or I can
> write:
> <div>
> </div>
> {::nomarkdown}
> <br />
> {:/}
> <div>
> </div>
> If you're going to argue about an edge case, here is an edge case to
> argue about:
> <div>
> </div>
> {::nomarkdown}<br />{:/}
> <div>
> </div>

This can also be explained: in the first case the extension tag is the
only thing on the line, therefore it is parsed by the block level
parser as the start of an extension block. In the second case there are
non-whitespace characters after the extension start tag, therefore it
is *not* processed by the block level extension parser but is converted
to a paragraph. Then the span level parser parses the extension.

-- Thomas

More information about the kramdown-users mailing list