Something should be done about code formatting functionality on the forum. Every single newcomer screws it up when asking questions about their code snippets. Tbh it's not really their fault. The default behavior of insert code
button facilitates this. Here's my observation of how it currently works. When you press insert code
button the following will happen:
- if nothing is selected, the editor will insert single quotes for inline code markup and position the cursor inside the quotes
- if a single line is selected, the editor will put single quotes for inline code markup around the selection
- if multiple lines are selected the editor will put triple quotes for block code markup around the selection
So the "expected" way to insert a block of code via gui is to paste the block, select it, and then press the insert code
button. However looks like nobody does it like this, and the button's misleading tooltip contributes to this.
People are first clicking the button (because, yeah, they want to insert the code) and then paste the code block. But doing it like that will always insert inline code tags, screwing the block's formatting.
Since in 99% of cases people want to post block and not inline code, the behavior of the insert code
button should be changed so it inserts ~~~ if nothing is selected.