2

While writing an issue in a GitHub repository, how can I:

  • Select a piece of text
  • And press something so that it is treated as code?

For example, here in Stack Exchange I can select a piece of text and press "Ctrl + K" to mark it as code. If I do this in GitHub markdown, it will mark it as a URL instead.

github markdown shortcut code

2
  • PS: There is a similar question to this one, but it treats code formatting, which is about spacing before the text. Jan 8, 2019 at 15:33
  • Relevant.
    – Alex
    Jan 8, 2019 at 15:56

1 Answer 1

2

In the GitHub editor, a button that looks like <> simply inserts a grave accent ` (also known as a "backtick") around the selected text. I don't see that there's a keyboard shortcut for it, though.

It seems far simpler to me to just add ` before and after your code block. (Which, incidentally, works the same way here.)

The list of available GitHub keyboard shortcuts

4
  • Thanks @ale, I know how to do it manually, a pitty that there are no shortcuts for it, because I use it a lot. Jan 8, 2019 at 16:58
  • 1
    I have contacted GitHub support, suggesting a keyboard shortcut for code. Jan 8, 2019 at 17:06
  • This is a very dissatisfying answer. I too am looking for a keyboard shortcut for this. Stating that you find it simple not to use a shortcut is not an answer. People who ask this and search for this don't see it that way.
    – Lukas
    Aug 27, 2019 at 10:41
  • @LucasBustamante did you get any feedback?
    – Lukas
    Aug 27, 2019 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.