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.

Possible Duplicate:
Unbalanced blank lines after inline HTML comments might break formatting

In this post: Formatting Sandbox the preview shows code (stuff indented 4 spaces), while the regular page does not. Here's the text of the post (originally from a question I was editing on SO):

i wrote sending email function that only work my debug mode(debug local server) when i publishing and hosting C# code that function not work. this my email configuration function

<!-- language: lang-xml -->
    <configuration>
        <system.net>
            <mailSettings>
                <smtp from="admin@XXXX.com">
                    <network host="smtp.XXXXX.com" port="25"
                             userName="admin@XXXXX.com" password="XXXXX" />
                </smtp>
            </mailSettings>
        </system.net>
        <appSettings/>
        <connectionStrings/>
        <system.web>

I discovered that if I put a blank line after the "language" comment then everything works.

It looks like this is maybe the issue reported at Unbalanced blank lines after inline HTML comments might break formatting

share|improve this question

marked as duplicate by Dori Jun 15 '11 at 10:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

While having the preview be different than the final post is a bug, the preview code is at fault.

Otherwise the result is as expected.

(1) Markdown strips out most HTML and (2) code must be indented at least 4 spaces and follow a blank line.

Since <!-- language: lang-xml --> wasn't indented, it was treated as HTML.

Since everything after it didn't follow a blank line, it was not recognized as a code block.

But the preview rendered incorrectly and didn't show that the indented HTML would be stripped.

share|improve this answer
2  
The HTML comment is not supposed to be indented: meta.stackexchange.com/questions/63800/… It is a way to tell the prettifier how to colorize the code that follows it. –  Gabe Mar 15 '11 at 8:08
    
Yes, but in that answer, notice that the following code has a blank line preceding it. –  Awesome Poodles Mar 15 '11 at 11:19
    
I'm not arguing that a blank line shouldn't precede it; I'm arguing that if a blank line doesn't precede it, the text should still show up (possibly not as code), and the preview should look like the page. –  Gabe Mar 15 '11 at 13:19
    
No, if the blank line doesn't precede it, the text -- which is XML/HTML code -- should NOT show up -- as the final post shows correctly. But, yes, the preview should look like the posted page. –  Awesome Poodles Mar 15 '11 at 23:49
    
I see, you're saying that it's actually the preview that's wrong. I'm fine with that. –  Gabe Mar 16 '11 at 0:24

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