This question already has an answer here:

Nowadays I see lots of questions using code sample display for highlight, not really on code samples.

This is an example how it looks.

I see comments about they are ok to use, and some other comments saying reverse. Is it ok to use them like that?

marked as duplicate by Frédéric Hamidi, Mat, Cody Gray, AakashM, hims056 Aug 22 '13 at 9:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Where in the world are you seeing comments that say this is OK? – Cody Gray Aug 22 '13 at 8:58
  • I was thinking this was not ok and wrote so, but someone commented the reverse: stackoverflow.com/questions/18375302/… – Kuzgun Aug 22 '13 at 9:03
  • 2
    @Kuzgun, the link in your previous comment is a counter-example: Every code block in that question is used to highlight either literal strings or class names. That's all right. – Frédéric Hamidi Aug 22 '13 at 9:05
  • 2
    Even more, @Kuzgun, in that example the OP is adding semantical information ("this is code", which happens to be rendered differently when looking at the regular website) rather than formatting ("I want this to look different"). Your suggesting to use bold would be formatting indeed, which would annoy me. – Arjan Aug 22 '13 at 9:27
  • Oh ok then, thank you Frédéric Hamidi, Arjan, Mat. – Kuzgun Aug 22 '13 at 9:46


Please don't use code formats for things that are not code. The highlight parts of a sentence you can use italics or bold. (Use them sparingly though.)

Plain English words, proper names, trademarks, etc. should not be set in code blocks.

Do use inline code blocks for short code snippets (int answer = 42;), or for instance to refer to variable names (like answer from the previous snippet or code block). Class, interface or type names, functions, etc. are fine in code blocks too (e.g. NSImmutableCactus should be set as code).

But if you find that you're following these rules but end up with text that's half English and half code, you would probably be better of refactoring it: explain the issue in plain English, and use a proper code snippet.


In GridView, I am trying to use HyperLinkField,I am trying to write 'mailto:' into its DataNavigateUrlFields parameter, but it renders to nothing: <a href=''>...</a>.

This is barely readable. Would be better as something like:

I'm trying to put an email link in my grid view by setting the URL field to a mailto link as follows:

<foo:GridView BarDegree="full" 
  DataNavigateUrlFields="<a href=mailto:{0}>{0}</a>" 
  Orientation="sideways" />

[Description of what happens]; [Question about how to fix it]

  • "italics" is not in italics :-/ – Felix Aug 22 '13 at 8:57
  • Just as an aside: though Stack Exchange does allows for <i> and <b>, Markdown nicely uses <em> and <strong> instead. Of course, often that looks the same. – Arjan Aug 22 '13 at 11:17

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