What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

Adding a newline before one of the closing </pre>'s might yield missing <p> .. </p> tags in other parts of the same post.

Things seem to be formatted fine if the first closing </pre> is on a new line by itself, or if all closing </pre>'s are on the last line of their <pre> blocks. But if the first closing </pre> is at the end of the last line, then using a closing </pre> on a new line somewhere later, messes up the text above it, a bit.

Example output (source):


Some text in <pre>, closing </pre> on the last line, causing some of the
following paragraphs to merge into one. Editing this pre-formatted block to
put the closing </pre> on a new line by itself, will fix the formatting of
those paragraphs, also in the preview.

Line, surrounded by blank lines. Should be a new paragraph followed by whitespace.

Another line, surrounded by blank lines. Should be a yet another new paragraph.

More text in <pre>, closing </pre> on the next line. When NOT changing the
closing </pre> of the previous pre-formatted block, then putting the closing
</pre> of THIS very pre-formatted block onto its last line, will also fix
the formatting of the paragraphs above.

Line, surrounded by blank lines. Should be a new paragraph followed by whitespace.

Fourth line, surrounded by blank lines. Should be a new paragraph again.


The above currently renders the lines following the first <pre> block without any <p> tags at all:

This question originally was an "answer" (not so much) at Preview should match the posted view. In its comments Jeff already found that this is indeed a bug in the original Perl version of Markdown and all descendants. It's not a big deal for me, so I'm just posting it here for future reference. Please just mark it as "won't fix". (I ran into it in revision 1 at some answer at Super User.)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Well, it might be fixable, because per the babelmark link, it is fixed in markdown.pl 1.0.2b8.

There is a new block-level HTML detection algorithm in markdown.pl 1.0.2b8 compared to markdown 1.0.1 but I haven't ported that across yet. I kind of suspect that's the fix.

I'll try to get to that..

edit: I incorporated the latest MarkdownSharp and indeed the new block detection algorithm fixes this.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .