Click here to Skip to main content
15,125,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hi guys,

I am always frustrated when I want to add code into the "Add comment" link under questions and answers. It seems that the <pre> tag is not working. <code> seems OK though.

I searched on CodeProject an article explaining how formatting works for comments, but I couldn't find.

If somebody could give a link or explain it, then I would feel relieved!

#realJSOP 24-Feb-11 9:40am
Bold text.
Italic text.
Big text.
Code text.
<pre>Code snippet</pre> text.
Olivier Levrey 24-Feb-11 10:11am
Yes: everything works but pre tag ;)
I added a suggestion in the forum Nishant gave in his answer.
Sandeep Mewara 24-Feb-11 9:51am
Better to update question/answer with code directly (instead of posting as a comment). If needed, drop a comment as a reply that you updated question/answer with code.
Nish Nishant 24-Feb-11 10:00am
Sometimes that's messy though. Because usually there's a conversation between OP and someone trying to help. When both the OP and the guy trying to help keep updating their answers, you quickly lose context. This is a design flaw in the QA threading/comenting system though.
Sandeep Mewara 24-Feb-11 10:02am
Luc Pattyn 24-Feb-11 10:12am
I would vote that up if I knew how to do so...
And I am in favor of PRE-tag support everywhere.


Such discussions should really be in this forum:[^]

I reckon the idea is that comments should not be used for big code snippets. But sometimes there's no other way. The comment system in the QA forum is a very poor forum implementation. It would be better to have the full forum (that's available for articles and message boards) attached to a QA thread. That way, any meta discussions take place in the forum, while only valid answers are posted in the non-forum QA portion of the thread.

Comments can also exist but merely for very simple queries to and fro, so comments should probably be limited to 20 words or so (256 characters).
#realJSOP 24-Feb-11 9:42am
Nish Nishant 24-Feb-11 9:43am
Well I did improve my answer :-)
Olivier Levrey 24-Feb-11 9:56am
OK thank you. I will follow your suggestion and post it in that forum, even though I agree that one shouldn't use comments to paste big pieces of code.
Nish Nishant 24-Feb-11 9:59am
You are welcome Olivier.
Sergey Alexandrovich Kryukov 24-Feb-11 15:21pm
Agree, my 5.
I didn't think you could use formatting tags in comments. Looks like the <pre> tag doesn't work.
Olivier Levrey 24-Feb-11 9:54am
Well once I wanted to check back one of my comments and I was surprised to see that somebody formatted it!... But now it returned to its previous state. I am wondering if I didn't dream it :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900