What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 149 Stack Exchange communities.

This question already has an answer here:

When responding to potential answers I sometimes like to include a code block to clarify what I'm talking about. Is it possible to have clean code-formatting in comments or only in questions and answers?

share|improve this question

marked as duplicate by CRABOLO, Martijn Pieters Dec 30 '14 at 17:03

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.

3  
You can do inline code in comments, but block-formatting is reserved for questions and answers. See: meta.stackexchange.com/questions/197/… –  Shog9 Feb 12 '10 at 18:53
1  
also see meta.stackexchange.com/questions/1149/… –  Ether Feb 12 '10 at 19:38
2  
Something like this? (`Something like this`?) –  Greg Bacon Feb 12 '10 at 19:53
    
So I suppose the answerer in this question is using some other kind of html markup injection? stackoverflow.com/questions/2643150/… –  Anderson Mar 23 '11 at 6:00
    
I see many people commenting multiple lines of code in comment section in a well formatter manner. How do they achieve it? Please help!! –  Unbreakable Dec 30 '14 at 15:28
    
There are so many answers in STACKOVERFLOW also which has long code section is comment section which is well formatted. Please tell me how do they do it. I am never able to post multiple lines of code while seeking clarifications. :( –  Unbreakable Dec 30 '14 at 15:30
1  
@Unbreakable please post a link to such comment and a screenshot maybe, not sure what you mean. –  Shadow Wizard Dec 30 '14 at 15:54
    
I mean to say sometimes I want to put some code in the comment section. But I am not able to format the code properly in the comment section. Is there any way we can format multiple lines of code the way we do in the "ANSWER" or "QUESTION" section. –  Unbreakable Dec 30 '14 at 16:00
    
@Unbreakable no, you did not understand. You said "long code section in comment which is well formatted". Such thing does not exist as far as I know, so I asked you to post link. If you did not actually see such thing please don't say otherwise. –  Shadow Wizard Dec 30 '14 at 16:10
    
Okey I will paste one. I did see it. –  Unbreakable Dec 30 '14 at 16:11

4 Answers 4

I haven't seen this as possible. The best you can do is use the back_tick to shade the code. That's why you don't see much in the way of code-blocks in comments. Only small references to specific pieces within a given answer

share|improve this answer
    
the next text should be different yes it ? starting now >> code –  sirnur Apr 24 '13 at 17:38
    
When did code quit working on stack-overflow? –  ebyrob Apr 28 '14 at 20:05

Comments, by design, are intended to convey brevity. If you have a code-block that you need to bring attention to, append onto your original post beneath a title like Update #2, and then reference it from within a comment if you need to.

If you have small inline examples, you can just wrap them in back-ticks ` var foo = bar.

share|improve this answer

Yea this is possible. See this answer.

Code Formating in Comments

share|improve this answer

You mean this or something more like multiple lines?

if you refer to inline coding, It's done with enclosing text with `, otherwise you can't

share|improve this answer
    
Something like this: int a = 1 –  juanformoso Feb 12 '10 at 18:55
    
this is bold ' this should be coe formate'. –  sirnur Apr 24 '13 at 17:45

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