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

Currently when I want to place a small piece of code in my comment... I click on help link and copy and paste the code single quotes, does anyone have a better method?

`

But when you write a question or answer, there is an easy Command + K short cut, why doesn't this same short cut work while writing a comment?

I understand the argument that code isn't supposed to be in comments... but why would they allow comments to accept a code block? Why not just disable all code in comments?

If comments accept code, then they should use the same Command + K short cut to access it.

share|improve this question
5  
These are not single quotes, these are backticks. Depending on your keyboard layouts they can be situated at various places. On the US keyboard layout they are on the top left key just under ESC. –  Hugo Dozois Nov 5 '13 at 19:41
    
Oh, my bad... I didn't even notice that it was the key to the left one my 1 key... but I still think they should allow the command + K shortcut –  Arian Nov 5 '13 at 19:43
1  
@HugoDozois This is going to make my life so much easier! Perhaps an answer? –  Richard Tingle Nov 5 '13 at 19:45
2  
@RichardTingle: Not sure if serious. –  Robert Harvey Nov 5 '13 at 19:47
    
@RobertHarvey Alas I am, perhaps I should be more embarrassed by my lack of knowledge regarding my own keyboard. But I’m not damn it! –  Richard Tingle Nov 5 '13 at 19:49

2 Answers 2

up vote 11 down vote accepted

These are not single quotes, these are backticks. Depending on your keyboard layouts they can be situated at various places. On the US keyboard layout they are on the top left key just under ESC.

keyboardLayout

share|improve this answer
2  
YAY! A hand drawn circle! I really don't think many people know that the code mark is actually a backtick, and a key on the keyboard, thanks! –  Arian Nov 5 '13 at 19:50
    
You mean all this is about is the backticks? –  Robert Harvey Nov 5 '13 at 19:50
    
@RobertHarvey Yeah, previously I would click the 'help' link under 'add comment', and it would show an example how to use code... I would then copy the backtick and use it that way. –  Arian Nov 5 '13 at 19:52
    

does anyone have a better method?

Nope. That's the way to do it.

But when you write a question or answer, there is an easy Command + K short cut, why doesn't this same short cut work while writing a comment?

Because comments are second-class citizens. They don't support inline carriage returns, and so are not suitable for extended code blocks. They are intended for clarification, not for posting code.

why would they allow comments to accept a code block? Why not just disable all code in comments?

Because it can be useful to have the ability to point out errors in someone else' code.

share|improve this answer

You must log in to answer this question.

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