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

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

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

  • Thanks @ale, I know how to do it manually, a pitty that there are no shortcuts for it, because I use it a lot. – Lucas Bustamante Jan 8 at 16:58
  • I have contacted GitHub support, suggesting a keyboard shortcut for code. – Lucas Bustamante Jan 8 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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