Working with indentation as formatting is a very annoying experience and it's clear that new users have a problem with it. Also, many users seem to be in support for triple-backticks.
There are many reasons for it to be the default.
You cannot hint the language with indented code blocks as easily as with triple-backticks.
There are questions that require code blocks in multiple languages, which is very easy and straight-forward with triple-backticks, by adding the language just after the ticks e.g. ```rust
or ```python
.
pub fn main() {}
def main(): pass
With indented code blocks you have to rely on somewhat obscure and deprecated HTML inlining, e.g. <!-- language: rust --> or <!-- language: python -->.
You cannot easily put two code blocks after each other
If you have one indented code block directly followed by another code block, they'll be merged into one. This makes the example I showed above confusing (along with wrong highlighting):
pub fn main() {}
def main(): pass
If you indent your code properly but accidentally forget an empty line in-between the text and the code, it'll not work.
When you get told that the code needs to be indented in order to be formatted as a code block, it can be a bit annoying and confusing when there are these additional rules.
This is text. This is indented text one line below.
This is text.
This is indented text two lines below.
It's slightly more annoying to insert code in an already existing code block.
Since I can't insert with tab, I'll have to insert with 4 spaces. If the code is indented, then I have to spam 4 extra spaces for every line I want to insert. And if I want to break up the code in two lines I'll have to make sure to indent the other line also to not mess up the formatting.
Backticks are what is used in the comments.
This will give more consistency and hint people on how to format code in the comment section.
Overall, the triple-backtick option is more convenient and easier for many people, and I think that it would be beneficial for many new users to properly format their code and for editors to fix bad formatting. Therefore, it should be the preferred default when using the GUI button or using the hotkey to create code sample.
<!-- language: lang-whatever -->
comment before the code block. See the footnote in meta.stackexchange.com/questions/184108/…<!-- language-all: lang-whatever -->
syntax. The form without the-all
only applies to one code block.ctrl+k
...{}
UI button as an indent/unindent, as that's a much more involved operation, and much more work to do by hand, when needed. Adding code fences using backticks is trivial to do by hand. All you have to do is hit the ` key six times and put each of the two sets of three on separate lines. Why expend a UI button to do something that's so trivial to do by hand?