I have found various questions or answers where the author formatted a code examples or console output using a four-space prefix, but this does not render with indentation. Times where this was noticed, and edit to enclose the code in <pre></pre> were accepted. Recently, however, such an edit was rolled back by someone other than the author with no explanation given.

Is there a policy or best practice regarding edits that simply improve readability in this way?

Pre versus four space indentation is probably germane. I don't see any formatting with four-space prefices though. I wonder if there is a browser issue.

This is a four-space indented line.
  This one is too, but it is indented and additional two spaces in from the first one.

It looks like this to me:

This is a four-space indented line.
This one is too, but it is indented an additional two spaces in from the first one.

My results are the same for a Firefox 15.0.1 installation that corporate-supplied for use when I must use something other than IE7 for business reasons. Again, there is no formatting on the four-space indented line.

IE7 screenshot IE7

Firefox 15.0.1 screenshot Firefox 15.0.1

share|improve this question
7  
Why do you wrap it in <pre> tags? The markdown formatting should work just fine, preserving indentation. Could you perhaps link one of the rejected edits so it's clear what you're talking about? –  Bart Nov 7 '12 at 16:55
    
Follow up question: What browser are you using? –  Bart Nov 7 '12 at 16:57
    
Corporate-supplied IE7. –  kbulgrien Nov 7 '12 at 16:58
2  
Ah, I seem to remember that IE7 (which is explicitly unsupported) has code rendering issues. You see a problem, but it works fine for us. Let's see if I can back that up with a related question. –  Bart Nov 7 '12 at 16:59
    
Please give us an example link. This shouldn't be happening, perhaps you're missing something. –  Second Rikudo Nov 7 '12 at 17:00
    
::face palm:: Ah...I think I may see the problem... meta.stackoverflow.com/questions/56161/… –  dmckee Nov 7 '12 at 17:01
    
I was recently permitted to use Firefox for situations where IE7 was not acceptable, but have not (yet) broken the habit of following the long-standing requirement to use IE7, however, Firefox 15 (explicitly supported) also fails to render indentation on four-space prefixed lines. –  kbulgrien Nov 7 '12 at 17:13
4  
Those 2 examples ('this is a four-space indented ilne') look the same to me... –  Joe Nov 7 '12 at 17:28
    
@Bart It depends on the tag, and the actual text, but using code formatting for input/output can result in coloring due to prettify. This doesn't really make sense for non-code text. <pre> will format it as plaintext (rather than markup, as well as preserving whitespace) without adding the coloring. –  Servy Nov 7 '12 at 17:50
    
-1? This is an actual problem that is not entirely resolved by RTFM regarding IE7. The question resulted from an attempt to avoid creating site noise because the editor didn't want to continue a practice that generated problems. Awareness of this possibility was triggered by the rollback of an edit that seemed to "make sense" based on author experience. The question also happens to to show that a "supported" 15.0.1 browser also fails to render indentation in some cases. The author "gets it" now. No thanks to those who punish responsible questioning for purposes of refining understanding. –  kbulgrien Nov 7 '12 at 18:01
    
@kbulgrien Just so you know, downvotes on Meta do not always mean your question is bad. As stated in the Meta FAQ, they are often used to express disagreement. In this case they might indicate "You should not make edits like those". Of course this is pure speculation on my part, but don't be too concerned about downvotes here. Meta rep means nothing. –  Bart Nov 7 '12 at 18:05
    
What's the problem with the FireFox screenshot? Am I missing the point there? –  Bart Nov 7 '12 at 18:40
    
The top "This is a four-space indented line." is not indented. If you edit my question, you will see that indeed that line is indented by four spaces, and not marked up with <pre>. but then this is another DOH moment. It is shaded. I would have to have more than one line to show indentation! –  kbulgrien Nov 7 '12 at 18:46
    
@kbulgrien The indentation is to tell the parser "this is a code block", if you want to indent farther, you need more spaces. –  Daniel Fischer Nov 7 '12 at 18:47
1  
It is supposed to look like that. It's markdown. 4 space indentation at the very beginning makes it a code block. This is exactly how it's supposed to work. –  Bart Nov 7 '12 at 18:47
show 3 more comments

1 Answer

Since you seem to be using Internet Explorer 7, which is explicitly unsupported, the problem is most likely related to the one described in this question.

What that means is that you see a problem with indentation, where there is none for the rest of us with decent browsers. :p The standard markdown formatting works just fine for all of us, preserving the indentation as desired.

Your "fix" therefore is unnecessary to the rest of us and rejected. (And the use of HTML tags can possibly break syntax highlighting or worse). The best advice is to switch to a proper browser, but if that's not possible (due to corporate restrictions) you best not try to fix code in posts for the moment.

As for the other issues you perceive: 4 space indentation of your text is the Markdown equivalent of creating a code block. If you want to have your code indented 4 spaces, you will have to add 8 spaces in front of it in the raw Markdown sources. So what you're seeing in FireFox is expected behavior. Nothing strange or unexpected there.

Please check out the Markdown Editing Help for further information.

share|improve this answer
    
Firefox 15.0.1 also fails to render the indentation. 15 is listed as supported. –  kbulgrien Nov 7 '12 at 17:10
1  
Hmm, I haven't heard of that issue. Can't reproduce it here for the moment. Let's see if someone else can back that up. –  Bart Nov 7 '12 at 17:13
    
Not just unnecessary - using the HTML tags can break syntax highlighting or worse if not done right, and even if the original editor is careful that doesn't mean future editors will be. –  Shog9 Nov 7 '12 at 17:43
    
@kbulgrien: I am using FF 16, used 15 without problems on SO, indentation working as intended. –  Martijn Pieters Nov 7 '12 at 18:01
    
@MartijnPieters If I was allowed to use picpaste sites from this network, I'd offer a Firefox 15.0.1 screenshot that IS NOT working as intended. –  kbulgrien Nov 7 '12 at 18:04
    
You can't use the standard image upload functionality of Meta SO? –  Bart Nov 7 '12 at 18:06
    
@kbulgrien: Just make the screenshot and link it here, we'll edit it in as an image if needed. –  Martijn Pieters Nov 7 '12 at 18:07
    
@Bart You are doing a great job of showing my newbishness. I had not stumbled upon such functionality. –  kbulgrien Nov 7 '12 at 18:11
    
Take that you newbie. :D You can use the Image button in the editor. This is next to the Code button. Clicking it allows you to add a file from your computer, uploading it to SO's own Imgur space. –  Bart Nov 7 '12 at 18:12
1  
Doh! I use a console editor religiously. I tend to avoid GUI editors. I perfunctorily ignored that widget bar. It reminds me of the time I had to tell someone on the phone to get out a ruler and measure about three inches in and down from the top corner of a terminal to give me the text they repeatedly said was not there. I also found meta.stackoverflow.com/questions/91716/… –  kbulgrien Nov 7 '12 at 18:18
    
The widget bar may come into play regarding Firefox 15.0.1 issues. If I highlight code then use the `{}' icon, the indentation shows up in Firefox 15.0.1, BUT if I manually put four spaces in front of each line, the indentation does not show up in Firefox 15.0.1. I am using Firefox 15.0.1, and the question still renders improperly (I prefixed the lines manually when composing it). –  kbulgrien Nov 7 '12 at 18:27
1  
@kbulgrien The four-space indented code that doesn't render properly, does that contain tabs? –  Daniel Fischer Nov 7 '12 at 18:33
    
@Daniel Fisher No. I typed them in the browser using only the spacebar. If you edit my question, you can see for yourself that it only appears to have spaces prefixing the broken (top) example. –  kbulgrien Nov 7 '12 at 18:39
    
@kbulgrien In this question here, what is supposedly the problem? Both screenshots show the code block rendered as it should be, as far as I can see. –  Daniel Fischer Nov 7 '12 at 18:46
    
I'm going to have to just accept that Firefox and IE7 rendering is unreliable. I fixed my example to show a two-space indentation under the first line, and Firefox continued to not show the two-space sub-indent until I edited it again to change the text to explicitly say it was indented an additional two spaces. When I did that, Firefox started rendering properly. I cannot explain this. I'll use Firefox for StackExchange, but I will stop attempting to fix indentation rendering issues as apparently I have not been supplied with a "decent" browser. –  kbulgrien Nov 7 '12 at 19:16
show 1 more comment

You must log in to answer this question.

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