When I write code using JS/HTML snippet editor (orange icon):
and paste code which contains one or more tab () characters as line indentation, then the snippet editor shows me this:
The same code in the answer "preview" looks like this:
While the same code in the answer editor looks like this:
So, we see three different places where code is viewed have different indentation for the line console.log('b')
. This inconsistency often forces the author to put "blind" line indentation fixes into the snippet editor to ensure the code is properly formatted when rendered.
My proposition: let's show code indentation in a consistent way (especially in the snippet editor and answer editor/preview)
For reproducibility, here is the snippet used for this question:
function f() {
console.log('a'); // I use 2 space to line indentation
console.log('b'); // I use tab to line indentation
}