Quantcast
Viewing latest article 2
Browse Latest Browse All 2

Indentation of tabs and spaces is inconsistent in Stack Snippets

When I write code using JS/HTML snippet editor (orange icon):

Image may be NSFW.
Clik here to view.

and paste code which contains one or more tab () characters as line indentation, then the snippet editor shows me this:

Image may be NSFW.
Clik here to view.

The same code in the answer "preview" looks like this:

Image may be NSFW.
Clik here to view.

While the same code in the answer editor looks like this:

Image may be NSFW.
Clik here to view.

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 indentationconsole.log('b'); // I use tab to line indentation}

Viewing latest article 2
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>