0

I went to edit a C++ question to fix the code formatting but noticed that the code seemed to already be properly formatted for markdown. The syntax highliting works but every line is starting at the left margin (no indentation). The post is using spaces to for indentation of inner blocks but the Markdown preview still shows no indentation. I added two spaces before the newline on previous lines with no success. I've search Meta for other Markdown bugs relating to code block indentation but came up empty. the closest question I could find was this one but it isn't helpful because when I use the code button the selected block gets removed and when I use the code button a second time the code block comes back but only the syntax highlighting works and the code is still unindented.

For example, when I add the following, it shows up highlighted but unindented both in the SO question and here on Meta. I'm using Internet Explorer 8 on Windows 7. I'm using normal crlf and spaces with no tabs.

for(int x = 0; x < 10; x++)   
    print(x);

To me looks the same as

for(int x = 0; x < 10; x++)   
print(x);
6
  • The code is using tabs for several levels instead of spaces. This causes the problems and is not a bug.
    – Bart
    Feb 20, 2013 at 15:51
  • The first few lines are not using tabs. I even deleted all the white space and inserted new crlf and spaces for just the case you mention. I did not go convert the whole codeblock once I saw that the indentation was not working for the first few lines I attempted to correct. Feb 20, 2013 at 15:57
  • I just now corrected the code block. All I did was exchange tabs for spaces. Seems to be fine now? If it doesn't look good to you, what browser and version are you using?
    – Bart
    Feb 20, 2013 at 16:06
  • It still shows up unindented to me using IE8 on Windows 7. I also created a new source block of two lines of Python which also become highlighted but the indentation was lost. I canceled that edit to check your version but have inserted it here to see if there was a difference between Markdown on SO vs. Meta. Feb 20, 2013 at 16:18
  • 1
    Are you by any chance using a compatibility mode in your browser? I do recall a code indentation issue for IE7.
    – Bart
    Feb 20, 2013 at 16:22
  • Afaik "IE8 is unsopported" is an adequate answer, letting me to vote as "leave open".
    – peterh
    Jan 11, 2021 at 19:13

1 Answer 1

1

Turn off IE8's Compatibility mode.

It was on and when I turned it off the indentation was correct. I've edited the question's title to reflect this. I'd guess the IE7 issue is still there in IE8.

4
  • Yeah, the IE definition of "compatibility" is "if it was broken back then, it should also be broken now" (which is kind of a good thing for a web dev, since you don't have to install every single IE version you want to test in).
    – balpha StaffMod
    Feb 20, 2013 at 20:19
  • "kind of a good thing for a web dev" ...unless, @balpha, you happen to be developing but don't know that IE by default enables this compatibility mode for what it thinks are intranet sites, and worse: without showing the button to disable that...
    – Arjan
    Feb 20, 2013 at 20:33
  • @Arjan Fortunately my corporate environment is different kinds of insane :)
    – balpha StaffMod
    Feb 20, 2013 at 20:38
  • Ah, a move, @balpha! Does that bring the remote worker closer to the office, or even further away? ;-)
    – Arjan
    Feb 20, 2013 at 20:41

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