Recently I've noticed that formatting whitespace in code blocks appears to be removed:

line1 - next line is prepended by six spaces
      line2 supposed to be indented but isn't

which the graphic snapshot below is clearly demonstrating: graphic snapshot Apparently, a some breaking change took place recently on SO as old posts having code blocks are similarly got stripped of formatting whitespace. This UI behavior creates a major headache for languages like F# where whitespace is syntactically significant.

Is it a bug or feature? And what would be the remedy apart from embedding code block images or placing snippets at foreign sites like pastebin?

This is using IE 10 Compatibility Mode on Windows 8.

  • 2
    Please provide a link that shows the issue. Even in your example, the line that is supposed to be indented... well... is.
    – Oded
    Commented Jun 14, 2013 at 19:00
  • For example, this one although I believe the embedded image demonstrates the problem quite clearly. Commented Jun 14, 2013 at 19:03
  • All the code seems to be formatted fine in the link.
    – Oded
    Commented Jun 14, 2013 at 19:04
  • Can you see if all JavaScript is loading and executing without error on your browser? (what browser are you using, by the way?)
    – Oded
    Commented Jun 14, 2013 at 19:06
  • I know that it is indented, but the fact that ... well, maybe in some browsers,... it visually looks not indented creates a major headaches for understanding the code for certain languages. Commented Jun 14, 2013 at 19:10
  • 1
    What browsers? I believe most of the users can, visually, see things as intended. Please give us some specifics that we can work with. Like - what browser are you using? What version? Are you getting any issues with JavaScript?
    – Oded
    Commented Jun 14, 2013 at 19:12
  • The effect is the same in IE10 and FireFox 21.0 on Win8. Lemme check how it looks on Win7 for other browsers... Commented Jun 14, 2013 at 19:13
  • I can't reproduce on Windows 7 using Chrome 27.0.1453.110 m or IE 10.
    – Oded
    Commented Jun 14, 2013 at 19:15
  • I can see now that the effect, in fact, is limited to IE10 ONLY on Win8. I'll withdraw the question in a minute as I can definitely live with this. Thank you for your help! Commented Jun 14, 2013 at 19:17
  • Don't withdraw it. I'll drop the status-norepro so we know what to look for.
    – Oded
    Commented Jun 14, 2013 at 19:18
  • Tried it in Win 8 on Chrome and IE10. Indentations show as intended and indented. Commented Jun 14, 2013 at 19:19
  • @Gene - is IE by chance not using standards mode?
    – Oded
    Commented Jun 14, 2013 at 19:20
  • 2
    Ok, I found the problem. Turning on 'Compatibility View' in IE10 (Win8) shows the problem of missing indentation. Commented Jun 14, 2013 at 19:24

2 Answers 2

I am trying
   to reproduce this using 4 spaces
using pre
    for example

or code element all alone by iteself

or using pre
  and code together.

The only one that displays an issue is the line that is <code></code> by iteself.

If you see at least two of the above code sections on a single line, please comment with the browser, OS and version you are using.

  • Only on the second snippet the second line is visually indented. Environment is IE 10.0.9200.16384 on Windows8 Pro x64. IE is in standard mode. Commented Jun 14, 2013 at 19:32
  • Yup, as @doubleDown noted the problem is tied to Compatibility Mode of IE10 on Win8. You may want to check JavaScript console to see the source of the problem. And thank you for fantastic resolution time!! Commented Jun 14, 2013 at 19:42

For more consistent behaviour you should use 4 spaces (rather than code/pre tags).

You must log in to answer this question.

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