Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Possible Duplicate:
Can we enable syntax highlighting for code in comments?
How to use formatting in comments?

How can I use syntax highlighting in comments, if I need to include some code in the comments?

Use case: I would add some code which I suppose would help the user, but people who don't feel the same start to downvote. So it's safer to post it in comments. But with syntax highlighting for code.

share|improve this question

marked as duplicate by Toon Krijthe, animuson, kiamlaluno, Alenanno, Bo Persson Oct 18 '12 at 14:38

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.

Why so many downvotes for the question? – saji89 Nov 18 '13 at 4:49
up vote 10 down vote accepted

The answer to this is pretty simple. There is no syntax highlighting in the comments. At most you can wrap your code in the usual back-ticks to give it somewhat of a different appearance, but that's about it.

You should not be posting substantial amounts of code in the comments anyway. They are not meant for that. Nor are they meant for extensive discussion or for content which should be guaranteed to stay around for a long time.

If you can, you might be better off making it an answer. If you can't, well, then you're stuck with the current limitations of comments and I can't see that changing any time soon.

share|improve this answer
Thanks for the answer. But I feel that its a feature that needs to be added. – saji89 Oct 18 '12 at 11:35
@saji89 It really doesn't. Code so substantial that it requires syntax highlighting does not belong in the comments. Formatting is off anyway with the absence of any decent indentation. Comments are not meant for such content, nor should they be made to be so IMHO. – Bart Oct 18 '12 at 11:36
I can see the point. Comments should be small and helpful. And more importantly not boringly long. Right? – saji89 Oct 18 '12 at 11:41

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