Quantcast
Channel: Active questions tagged code-formatting - Meta Stack Overflow
Viewing all articles
Browse latest Browse all 180

Code blocks: spaces vs fences [duplicate]

$
0
0

Recently I've been seeing quite a number of "suggested edits" that do nothing other than change a perfectly valid "indented code block" (using 4 spaces) to a code block enclosed by fences (```). Sometimes this includes a language specifier, but not always.

I tend to reject these as "no improvement" unless the language specifier makes a difference.

I wonder if this is the right thing to do. It is not clear to me if one style is preferred over the other: The code formatting tip on the "ask a question" form only mentions fences, but the editing-help page mentions spaces first.

So, my question:

Is there a preferred method for writing code blocks? Should we all start using fences instead of spaces, because this allows us to specify the language?

This meta answer says:

... edits changing the old language directive to code fences are not desirable, unless ...


Viewing all articles
Browse latest Browse all 180

Trending Articles



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