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.