Enclosing code/text elements in the code tag varies user to user. For example, one user put 'decimal' inside the code tag. Then another user edited the post and put it as simple text. Such types of examples are very frequent in Stack Overflow. It is confusing. Is there any guideline about which elements can be put inside the tag within the description?

  • They're called "code" tags for a reason. – TheWanderer Jul 30 '19 at 19:51
  • 1
    This is also better discussed on Stack Overflow's Meta – Robert Longson Jul 30 '19 at 20:06
  • @Robert Longson, sorry to say I can't post at Stack Overflow Meta due to the lack of reputation. – Saikat Mondal Jul 30 '19 at 20:13
  • 2
    MSO duplicate: meta.stackoverflow.com/questions/254990/… – rene Jul 30 '19 at 20:16
  • 1
    possible duplicate here on MSE: meta.stackexchange.com/questions/135112/… – rene Jul 30 '19 at 20:17
  • @rene, yes, the discussion somewhat clarify my concern. Still, there is controversy. What elements can be considered as code/code like artifacts? I am asking for a complete picture. – Saikat Mondal Jul 30 '19 at 20:43
  • 1
    That would require me to list every class, keyword for every programming language to complete a list to be code like artifacts. It isn't a big deal and unless someone is going into a roll-back war I wouldn't bother too much about it. Best way to get guidance is by linking to examples and discuss those on a case-by-case basis. – rene Jul 30 '19 at 20:56

It's a code tag, not a formatting tag.

If it's code snippets, configuration file snippets or something shown in a console, and requires formatting to be preserved to make sense use code tags. For many languages on sites like SO this also gives you syntax highlighting.

You do not use code blocks to format things - usually. 'You use the decimal type' and 'You use the decimal type' are functionally similar. However the latter feels more natural. However "Run foobar.exe /baz" is more readable than "Run foobar.exe /baz".

You might also want to take a look at the edit reasons to get an idea of the editor's reasons. Fundamentally - always pick the clearer more readable format for the content.

Not the answer you're looking for? Browse other questions tagged .