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.

This and related bugs have repeatedly been reported here, here, here and here, which is four times in four months. And there are many many more of the same reports, unfortunately.

My issue? Almost the same. But in my case it was even more scary: the entire code block of this question disappeared during typing and when submitting. It is easily reproducible:

  1. Copy the following code
  2. Then do something

See the code above this line? No? If you do, this bug is fixed, if you don't the bug is still there. Code to reproduce:

1. Copy the following code
3. Then do something

    <xsl:import @href="test.xsl">

This "bug" has sometimes incorrectly been considered "by design", a feature or, most often, as a duplicate. I just bring it up again because it is being reported so often and because this behavior is far from intuitive. Most of the reporters complain that it takes so long to figure out how to workaround this bug. And if you are an occasional poster, unintuitive behavior or odd workarounds don't stick and can put people off when they have to figure it out again.

I suggest: fix it, to prevent further reports, wasted time figuring out or explaining the issue. If I can be of any assistance to fixing it, please let me know.

share|improve this question
    
I experience this bug all the time. I tend to answer questions with a list, followed by code. It makes it easy to scan and highlight points without making the users read much. My preferred format to answering questions is considered a bug by design? Sounds odd. I usually solve this by using a horizontal bar between the list and the code. –  Levi Morrison Nov 15 '11 at 17:38
    
@Levi: this issue was about the code blocks disappearing in lists. That can hardly be the intended behavior, can it? And surely, you don't answer question by writing invisible code blocks? –  Abel Nov 15 '11 at 18:50

1 Answer 1

up vote 1 down vote accepted

This is extremely by design. You must indent 8 spaces, as you're "within" a numbered list at this point.

Try it in babelmark if you don't believe me.

http://babelmark.bobtfish.net/

What you want is this:

1. Copy the following code
3. Then do something

        <xsl:import @href="test.xsl">

or this:

1. Copy the following code
3. Then do something

look ma, a paragraph!

    <xsl:import @href="test.xsl">

or this:

1. Copy the following code
3. Then do something

 &lt;xsl:import @href="test.xsl"&gt;

or this:

1. Copy the following code
3. Then do something

   `<xsl:import @href="test.xsl">`
share|improve this answer
2  
By design? Hmm, imo, exceptional behavior, that doesn't fit in the basic structure or rules of a product, is either bad design or a bug. But I can be wrong. I am aware of the 8-spaces rule, it is in the FAQ and I already included links to workarounds. The 8-spaces "trick" is for code blocks inside a list with extra margin, that's not the point here. The expected behavior: "a list followed by a code block not followed by a list should use normal indentation" does not occur and the continued bugreports on the same subject proof imo that many people struggle with the absence of alogic rule. –  Abel Oct 26 '09 at 0:26
    
it's simply part of the markdown spec, try it yourself at babelmark.bobtfish.net –  Jeff Atwood Oct 26 '09 at 2:28
2  
Well, there are already some cases where SO doesn't adhere to the markdown spec because it are cases where the spec leads to surprising/unwanted results. Making it impossible to have a code block following a list doesn't sound like a case where it's essential to follow the spec... –  sth Oct 26 '09 at 4:51
1  
I fail to see how the "spec" (I assume you mean this: daringfireball.net/projects/markdown/syntax) has any official status. It's a nice initiative and naturally you're reluctant to deviate from it, but when a "feature" of a so-called "spec" causes more trouble then joy, it should become eligible for reconsideration. If that's not possible (and even w3c specs are reconsidered!), then the "spec" becomes a millstone around your neck and prevents improvement. Just allow for reflection and self-criticism, especially on third-party specs. –  Abel Oct 26 '09 at 16:58
7  
I downvoted this because it is 100% unintuitive. This is 100x worse than the two-spaces for line break rule, and I like that rule. Are there lots of other examples of blocks in markdown that are not terminated by a couple of newlines? Also, while the spec discusses nesting code blocks, I don't see a rule that says a code block may never follow a list. –  Harvey Mar 20 '10 at 22:31
    
While I don't agree with the answer, it's an answer that answers the question, so I accepted. However, I downvoted for the same reason as @Harvey here, as I don't think this is intuitive at all. –  Abel Apr 4 '12 at 16:25

You must log in to answer this question.

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