-3

There is no syntax highlighting nor any ways to emphasize code written in comments.

I have noticed that this is one of the key factors leading users to misunderstand one another.

I use the backticks (`` ) and%` signs at the moment for code that I write in comments.

Please, give us an option to turn syntax highlighting on for comments. We cannot avoid the fact that that some users decide to put code in their comments.

5
  • Comments are meant for shortish (note the 600 character limit) remarks on the question or answer. If you have code then add it to your question or answer - or post a new answer.
    – ChrisF Mod
    Jul 1, 2009 at 9:44
  • 1
    we might make bold and italic work, but that's about it. Jul 3, 2009 at 2:17
  • 2
    @Jeff Atwood: Don't forget backticks along with bold and italic.
    – mmx
    Jul 3, 2009 at 3:17
  • 1
    @Jeff: Thank you! Comments look now awesome :)
    – Masi
    Jul 4, 2009 at 10:01
  • 1
    @Masi: Ironically, the new implementation just broke one of your comments: stackoverflow.com/questions/679108/… Jul 14, 2009 at 14:17

4 Answers 4

6

At least, I would want bold and italic to work.

As for syntax highlighting, you don't get that for simple inlined code sections, so why would you need it in comments.

5
  • If you mean that we should have inclined code sections in comments, then I support your idea.
    – Masi
    Jun 30, 2009 at 18:29
  • Again inclined code in comments defeats the purpose of what a comment is for. There's a reason its character limited as well. Jun 30, 2009 at 18:35
  • I actually think I would like the inlined code sections to work, as a highlighting feature. Jun 30, 2009 at 20:08
  • @Brad Gilbert: I agree with you! That would be great.
    – Masi
    Jul 1, 2009 at 14:34
  • 4
    Hey look at This, Code examples work too. Jul 3, 2009 at 13:45
5

Comments aren't the proper place for full blown code. For one, it isn't even multi-line. Secondly there's no other way to format a comment.

If you have the need to post enough code that it requires syntax highlighting, then post it as an answer, or have the person requiring it ask another question where you can provide an answer there.

1
  • Or ask a question yourself and provide the answer to it. Jun 30, 2009 at 17:47
3

This is why you are supposed to edit your question or answer. Comments were just not meant for extended discussion.

Keep the comments short and simple please.

3
  • 1
    @Rich: I agree with you that comments should be short and simple. However, we cannot avoid that people put codes to comments. --- Therefore, I would like to have the code highlighting for comments optionally such that you can put it on if you have enough rep.
    – Masi
    Jun 30, 2009 at 14:57
  • @Masi: We can avoid that by not encouraging the behavior. Code in comments is not acceptable (at least not enough where you would need highlighting), so why would we encourage this? Comments are less functional by design.
    – GEOCHET
    Jun 30, 2009 at 15:02
  • @Rich B: While I don't want full syntax highlighting in the comments, I wouldn't mind the ability to put stuff in backticks like in an answer. Jun 30, 2009 at 20:30
2

I suggest that atleast add support for a New Line. Presently, everything gets posted in one line. Its quite ugly.

You must log in to answer this question.