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

When I write some text, select it, and press the "code sample" button, it surrounds the selected text with single backticks. This is not sufficient to turn the text into a code sample in the case where the text itself contains backticks.

For example, if I write:

[...] SELECT `foo` from `bar` [...]

select the text, and press Ctrl+K, it produces:

[...] `SELECT `foo` from `bar [...]

where what I really want is:

[...] `` SELECT `foo` from `bar` `` [...]

The correct behaviour, in my opinion, would be to count the longest contiguous sequence of backticks in the selected text, and insert a sequence one longer at the beginning and end (separated by a space to cater for the case where the text begins or ends with a backtick itself). If anyone has any examples where that would not produce the desired result, please point them out.

(It seems like the current code sample button acts as a toggle, removing backticks if present. I think this behaviour is counterintuitive in general and should probably be dropped. At the least, it should ensure there are backticks on both ends of the selected text before dropping either of them).

To clarify, I am saying that on input like the above, the code sample button behaves incorrectly (hence the bug tag). I already know how to escape the backticks properly, but the editor does not, and should be taught.

share|improve this question
    
@hammar where do you see anything about an escape button in the editor? –  amanaP lanaC A nalP A naM A Dec 6 '12 at 19:35
1  
Notice that I include a description of how to escape the backticks in my question, so that's pretty clearly not what I'm asking for. I've added some clarifying remarks. –  Ben Millwood Dec 6 '12 at 21:17

You must log in to answer this question.

Browse other questions tagged .