2

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="[email protected]">
                    <network host="smtp.XXXXX.com" port="25"
                             userName="[email protected]" 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

0

1 Answer 1

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.

5
  • 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
    Commented Mar 15, 2011 at 8:08
  • Yes, but in that answer, notice that the following code has a blank line preceding it. Commented Mar 15, 2011 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
    Commented Mar 15, 2011 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. Commented Mar 15, 2011 at 23:49
  • I see, you're saying that it's actually the preview that's wrong. I'm fine with that.
    – Gabe
    Commented Mar 16, 2011 at 0:24

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