GitHub – Basic writing and formatting syntax, Keyboard Shortcuts

-

Affiliate Disclosure: Every purchase made through our affiliate links earns us a pro-rated commission without any additional cost to you. Here are more details about our affiliate disclosure.

This post will help you for GitHub – Basic writing and formatting syntax, Keyboard Shortcuts.

Create sophisticated formatting for your prose and code on GitHub with simple syntax.

GitHub – Basic writing and formatting syntax

Headings

To create a heading, add one to six # symbols before your heading text. The number of # you use will determine the size of the heading.

# The largest heading
## The second largest heading
###### The smallest heading

When you use two or more headings, GitHub automatically generates a table of contents which you can access by clicking  within the file header. Each heading title is listed in the table of contents and you can click a title to navigate to the selected section.

Styling text

You can indicate emphasis with bold, italic, or strikethrough text in comment fields and .md files.

StyleSyntaxKeyboard shortcutExampleOutput
Bold** ** or __ __Command+B (Mac) or Ctrl+B (Windows/Linux)**This is bold text**This is bold text
Italic* * or _ _     Command+I (Mac) or Ctrl+I (Windows/Linux)*This text is italicized*This text is italicized
Strikethrough~~ ~~~~This was mistaken text~~This was mistaken text
Bold and nested italic** ** and _ _**This text is _extremely_ important**This text is extremely important
All bold and italic*** ******All this text is important***All this text is important

Quoting text

You can quote text with a >.

Text that is not a quote

> Text that is a quote

Tip: When viewing a conversation, you can automatically quote text in a comment by highlighting the text, then typing R. You can quote an entire comment by clicking , then Quote reply.

Quoting code

You can call out code or a command within a sentence with single backticks. The text within the backticks will not be formatted. You can also press the Command+E (Mac) or Ctrl+E (Windows/Linux) keyboard shortcut to insert the backticks for a code block within a line of Markdown.

Use `git status` to list all new or modified files that haven't yet been committed.

To format code or text into its own distinct block, use triple backticks.

Some basic Git commands are:
```
git status
git add
git commit
```

If you are frequently editing code snippets and tables, you may benefit from enabling a fixed-width font in all comment fields on GitHub.

You can create an inline link by wrapping link text in brackets [ ], and then wrapping the URL in parentheses ( ). You can also use the keyboard shortcut Command+K to create a link. When you have text selected, you can paste a URL from your clipboard to automatically create a link from the selection.

This site was built using [GitHub Pages](https://pages.github.com/).

Tip: GitHub automatically creates links when valid URLs are written in a comment.

You can link directly to a section in a rendered file by hovering over the section heading to expose the link:

You can define relative links and image paths in your rendered files to help readers navigate to other files in your repository.

A relative link is a link that is relative to the current file. For example, if you have a README file in root of your repository, and you have another file in docs/CONTRIBUTING.md, the relative link to CONTRIBUTING.md in your README might look like this:

[Contribution guidelines for this project](docs/CONTRIBUTING.md)

GitHub will automatically transform your relative link or image path based on whatever branch you’re currently on, so that the link or path always works. You can use all relative link operands, such as ./ and ../.

Relative links are easier for users who clone your repository. Absolute links may not work in clones of your repository – we recommend using relative links to refer to other files within your repository.

Images

You can display an image by adding ! and wrapping the alt text in [ ]. Then wrap the link for the image in parentheses ().

![This is an image](https://myoctocat.com/assets/images/base-octocat.svg)

GitHub supports embedding images into your issues, pull requests, discussions, comments and .md files. You can display an image from your repository, add a link to an online image, or upload an image.

Tip: When you want to display an image which is in your repository, you should use relative links instead of absolute links.

Here are some examples for using relative links to display an image.

ContextRelative Link
In a .md file on the same branch/assets/images/electrocat.png
In a .md file on another branch/../main/assets/images/electrocat.png
In issues, pull requests and comments of the repository../blob/main/assets/images/electrocat.png
In a .md file in another repository/../../../../github/docs/blob/main/assets/images/electrocat.png
In issues, pull requests and comments of another repository../../../github/docs/blob/main/assets/images/electrocat.png?raw=true

Note: The last two relative links in the table above will work for images in a private repository only if the viewer has at least read access to the private repository which contains these images.

Specifying the theme an image is shown to

You can specify the theme an image is displayed to by appending #gh-dark-mode-only or #gh-light-mode-only to the end of an image URL, in Markdown.

We distinguish between light and dark color modes, so there are two options available. You can use these options to display images optimized for dark or light backgrounds. This is particularly helpful for transparent PNG images.

ContextURL
Dark Theme![GitHub Light](https://github.com/github-light.png#gh-dark-mode-only)
Light Theme![GitHub Dark](https://github.com/github-dark.png#gh-light-mode-only)

Lists

You can make an unordered list by preceding one or more lines of text with - or *.

- George Washington
- John Adams
- Thomas Jefferson

To order your list, precede each line with a number.

1. James Madison
2. James Monroe
3. John Quincy Adams

Nested Lists

You can create a nested list by indenting one or more list items below another item.

To create a nested list using the web editor on GitHub or a text editor that uses a monospaced font, like Atom, you can align your list visually. Type space characters in front of your nested list item, until the list marker character (- or *) lies directly below the first character of the text in the item above it.

1. First list item
   - First nested list item
     - Second nested list item

To create a nested list in the comment editor on GitHub, which doesn’t use a monospaced font, you can look at the list item immediately above the nested list and count the number of characters that appear before the content of the item. Then type that number of space characters in front of the nested list item.

In this example, you could add a nested list item under the list item 100. First list item by indenting the nested list item a minimum of five spaces, since there are five characters (100. ) before First list item.

100. First list item
     - First nested list item

You can create multiple levels of nested lists using the same method. For example, because the first nested list item has seven characters (␣␣␣␣␣-␣) before the nested list content First nested list item, you would need to indent the second nested list item by seven spaces.

100. First list item
     - First nested list item
       - Second nested list item

Task lists

To create a task list, preface list items with a hyphen and space followed by [ ]. To mark a task as complete, use [x].

- [x] #739
- [ ] https://github.com/octo-org/octo-repo/issues/740
- [ ] Add delight to the experience when all tasks are complete :tada:

If a task list item description begins with a parenthesis, you’ll need to escape it with \:

- [ ] \(Optional) Open a followup issue

Mentioning people and teams

You can mention a person or team on GitHub by typing @ plus their username or team name. This will trigger a notification and bring their attention to the conversation. People will also receive a notification if you edit a comment to mention their username or team name.

@github/support What do you think about these updates?

When you mention a parent team, members of its child teams also receive notifications, simplifying communication with multiple groups of people.

Typing an @ symbol will bring up a list of people or teams on a project. The list filters as you type, so once you find the name of the person or team you are looking for, you can use the arrow keys to select it and press either tab or enter to complete the name. For teams, enter the @organization/team-name and all members of that team will get subscribed to the conversation.

The autocomplete results are restricted to repository collaborators and any other participants on the thread.

Referencing issues and pull requests

You can bring up a list of suggested issues and pull requests within the repository by typing #. Type the issue or pull request number or title to filter the list, and then press either tab or enter to complete the highlighted result.

Referencing external resources

If custom autolink references are configured for a repository, then references to external resources, like a JIRA issue or Zendesk ticket, convert into shortened links. To know which autolinks are available in your repository, contact someone with admin permissions to the repository.

Uploading assets

You can upload assets like images by dragging and dropping, selecting from a file browser, or pasting. You can upload assets to issues, pull requests, comments, and .md files in your repository.

Using emoji

You can add emoji to your writing by typing :EMOJICODE:.

@octocat :+1: This PR looks great - it's ready to merge! :shipit:

Typing : will bring up a list of suggested emoji. The list will filter as you type, so once you find the emoji you’re looking for, press Tab or Enter to complete the highlighted result.

For a full list of available emoji and codes, check out the Emoji-Cheat-Sheet.

Paragraphs

You can create a new paragraph by leaving a blank line between lines of text.

Footnotes

You can add footnotes to your content by using this bracket syntax:

Here is a simple footnote[^1].

A footnote can also have multiple lines[^2].  

You can also use words, to fit your writing style more closely[^note].

[^1]: My reference.
[^2]: Every new line should be prefixed with 2 spaces.  
  This allows you to have a footnote with multiple lines.
[^note]:
    Named footnotes will still render with numbers instead of the text but allow easier identification and linking.  
    This footnote also has been made with a different syntax using 4 spaces for new lines.

The footnote will render like this:

Note: The position of a footnote in your Markdown does not influence where the footnote will be rendered. You can write a footnote right after your reference to the footnote, and the footnote will still render at the bottom of the Markdown.

Hiding content with comments

You can tell GitHub to hide content from the rendered Markdown by placing the content in an HTML comment.

<!-- This content will not appear in the rendered Markdown -->

Ignoring Markdown formatting

You can tell GitHub to ignore (or escape) Markdown formatting by using \ before the Markdown character.

Let's rename \*our-new-project\* to \*our-old-project\*.

Disabling Markdown rendering

When viewing a Markdown file, you can click  at the top of the file to disable Markdown rendering and view the file’s source instead.

Disabling Markdown rendering enables you to use source view features, such as line linking, which is not possible when viewing rendered Markdown files.

Read Also: Complete SEO Checklist for your Website

Keyboard shortcuts for GitHub

Nearly every page on GitHub has a keyboard shortcut to perform actions faster.

About keyboard shortcuts

Typing ? on GitHub brings up a dialog box that lists the keyboard shortcuts available for that page. You can use these keyboard shortcuts to perform actions across the site without using your mouse to navigate.

You can disable character key shortcuts, while still allowing shortcuts that use modifier keys, in your accessibility settings.

Below is a list of some of the available keyboard shortcuts.

The GitHub Command Palette also gives you quick access to a wide range of actions, without the need to remember keyboard shortcuts.

Site wide shortcuts

Keyboard shortcutDescription
S or /Focus the search bar.
G NGo to your notifications.
EscWhen focused on a user, issue, or pull request hovercard, closes the hovercard and refocuses on the element the hovercard is in
Command+K (Mac) or
Ctrl+K (Windows/Linux)
Opens the GitHub Command Palette. If you are editing Markdown text, open the command palette with Command+Option+K or Ctrl+Alt+K.

Repositories

Keyboard shortcutDescription
G CGo to the Code tab
G IGo to the Issues tab.
G PGo to the Pull requests tab.
G AGo to the Actions tab.
G BGo to the Projects tab.
G WGo to the Wiki tab.
G GGo to the Discussions tab.

Source code editing

Keyboard shortcutDescription
.Opens a repository or pull request in the web-based editor.
Command+B (Mac) or
Ctrl+B (Windows/Linux)
Inserts Markdown formatting for bolding text
Command+I (Mac) or
Ctrl+I (Windows/Linux)
Inserts Markdown formatting for italicizing text
Command+K (Mac) or
Ctrl+K (Windows/Linux)
Inserts Markdown formatting for creating a link
Command+Shift+7 (Mac) or
Ctrl+Shift+7 (Windows/Linux)
Inserts Markdown formatting for an ordered list
Command+Shift+8 (Mac) or
Ctrl+Shift+8 (Windows/Linux)
Inserts Markdown formatting for an unordered list
Command+Shift+. (Mac) or
Ctrl+Shift+. (Windows/Linux)
Inserts Markdown formatting for a quote
EOpen source code file in the Edit file tab
Command+F (Mac) or
Ctrl+F (Windows/Linux)
Start searching in file editor
Command+G (Mac) or
Ctrl+G (Windows/Linux)
Find next
Command+Shift+G (Mac) or
Ctrl+Shift+G (Windows/Linux)
Find previous
Command+Option+F (Mac) or
Ctrl+Shift+F (Windows/Linux)
Replace
Command+Shift+Option+F (Mac) or
Ctrl+Shift+R (Windows/Linux)
Replace all
Alt+GJump to line
Command+Z (Mac) or
Ctrl+Z (Windows/Linux)
Undo
Command+Y (Mac) or
Ctrl+Y (Windows/Linux)
Redo
Command+Shift+PToggles between the Edit file and Preview changes tabs
Command+S (Mac) or
Ctrl+S (Windows/Linux)
Write a commit message

Source code browsing

Keyboard shortcutDescription
TActivates the file finder
LJump to a line in your code
WSwitch to a new branch or tag
YExpand a URL to its canonical form.
IShow or hide comments on diffs.
AShow or hide annotations on diffs
BOpen blame view.

Comments

Keyboard shortcutDescription
Command+B (Mac) or
Ctrl+B (Windows/Linux)
Inserts Markdown formatting for bolding text
Command+I (Mac) or
Ctrl+I (Windows/Linux)
Inserts Markdown formatting for italicizing text
Command+E (Mac) or
Ctrl+E (Windows/Linux)
Inserts Markdown formatting for code or a command within a line
Command+K (Mac) or
Ctrl+K (Windows/Linux)
Inserts Markdown formatting for creating a link
Command+Shift+P (Mac) or
Ctrl+Shift+P (Windows/Linux)
Toggles between the Write and Preview comment tabs
Command+Shift+V (Mac) or
Ctrl+Shift+V (Windows/Linux)
Pastes HTML link as plain text
Command+Shift+7 (Mac) or
Ctrl+Shift+7 (Windows/Linux)
Inserts Markdown formatting for an ordered list
Command+Shift+8 (Mac) or
Ctrl+Shift+8 (Windows/Linux)
Inserts Markdown formatting for an unordered list
Command+Enter (Mac) or
Ctrl+Enter (Windows/Linux)
Submits a comment
Ctrl+. and then Ctrl+[saved reply number]Opens saved replies menu and then autofills comment field with a saved reply.
Command+Shift+. (Mac) or
Ctrl+Shift+. (Windows/Linux)
Inserts Markdown formatting for a quote
Command+G (Mac) or
Ctrl+G (Windows/Linux)
Insert a suggestion.
RQuote the selected text in your reply.

Issue and pull request lists

Keyboard shortcutDescription
CCreate an issue
Command+/ (Mac) or
Ctrl+/ (Windows/Linux)
Focus your cursor on the issues or pull requests search bar.
UFilter by author
LFilter by or edit labels.
Alt and clickWhile filtering by labels, exclude labels.
MFilter by or edit milestones.
AFilter by or edit assignee.
O or EnterOpen issue

Issues and pull requests

Keyboard shortcutDescription
QRequest a reviewer.
MSet a milestone.
LApply a label.
ASet an assignee.
XLink an issue or pull request from the same repository.
Command+Shift+P (Mac) or
Ctrl+Shift+P (Windows/Linux)
Toggles between the Write and Preview tabs
Alt and clickWhen creating an issue from a task list, open the new issue form in the current tab by holding Alt and clicking the  in the upper-right corner of the task.
Shift and clickWhen creating an issue from a task list, open the new issue form in a new tab by holding Shift and clicking the  in the upper-right corner of the task.
Command and click (Mac) or
Ctrl+Shift and click (Windows/Linux)
When creating an issue from a task list, open the new issue form in the new window by holding Command or Ctrl+Shift and clicking the  in the upper-right corner of the task.

Changes in pull requests

Keyboard shortcutDescription
COpen the list of commits in the pull request
TOpen the list of changed files in the pull request
JMove selection down in the list
KMove selection up in the list
Command+Shift+EnterAdd a single comment on a pull request diff
Alt and clickToggle between collapsing and expanding all outdated review comments in a pull request by holding down Alt and clicking Show outdated or Hide outdated.
Click, then Shift and clickComment on multiple lines of a pull request by clicking a line number, holding Shift, then clicking another line number.

Project boards

Moving a column

Keyboard shortcutDescription
Enter or SpaceStart moving the focused column
EscCancel the move in progress
EnterComplete the move in progress
 or HMove column to the left
Command+ or Command+H (Mac) or
Ctrl+ or Ctrl+H (Windows/Linux)
Move column to the leftmost position
 or LMove column to the right
Command+ or Command+L (Mac) or
Ctrl+ or Ctrl+L (Windows/Linux)
Move column to the rightmost position

Moving a card

Keyboard shortcutDescription
Enter or SpaceStart moving the focused card
EscCancel the move in progress
EnterComplete the move in progress
 or JMove card down
Command+ or Command+J (Mac) or
Ctrl+ or Ctrl+J (Windows/Linux)
Move card to the bottom of the column
 or KMove card up
Command+ or Command+K (Mac) or
Ctrl+ or Ctrl+K (Windows/Linux)
Move card to the top of the column
 or HMove card to the bottom of the column on the left
Shift+ or Shift+HMove card to the top of the column on the left
Command+ or Command+H (Mac) or
Ctrl+ or Ctrl+H (Windows/Linux)
Move card to the bottom of the leftmost column
Command+Shift+ or Command+Shift+H (Mac) or
Ctrl+Shift+ or Ctrl+Shift+H (Windows/Linux)
Move card to the top of the leftmost column
Move card to the bottom of the column on the right
Shift+ or Shift+LMove card to the top of the column on the right
Command+ or Command+L (Mac) or
Ctrl+ or Ctrl+L (Windows/Linux)
Move card to the bottom of the rightmost column
Command+Shift+ or Command+Shift+L (Mac) or
Ctrl+Shift+ or Ctrl+Shift+L (Windows/Linux)
Move card to the bottom of the rightmost column

Previewing a card

Keyboard shortcutDescription
EscClose the card preview pane

GitHub Actions

Keyboard shortcutDescription
Command+Space (Mac) or
Ctrl+Space (Windows/Linux)
In the workflow editor, get suggestions for your workflow file.
G FGo to the workflow file
Shift+T or TToggle timestamps in logs
Shift+F or FToggle full-screen logs
EscExit full-screen logs

Notifications

Keyboard shortcutDescription
EMark as done
Shift+UMark as unread
Shift+IMark as read
Shift+MUnsubscribe

Network graph

Keyboard shortcutDescription
 or HScroll left
 or LScroll right
 or KScroll up
 or JScroll down
Shift+ (Mac) or
Shift+H (Windows/Linux)
Scroll all the way left
Shift+ (Mac) or
Shift+L (Windows/Linux)
Scroll all the way right
Shift+ (Mac) or
Shift+K (Windows/Linux)
Scroll all the way up
Shift+ (Mac) or
Shift+J (Windows/Linux)
Scroll all the way down

Keywords

  • GitHub – Basic writing and formatting syntax,
  • GitHub Keyboard Shortcuts
  • Keyboard Shortcuts for GitHub
  • Basic writing and Formatting syntax for GitHub
Related Articles

Like our Article/ Blog? Can buy a Buttermilk for our team.. Click here

Pardeep Patelhttps://pardeeppatel.com/
Hi!, I am Pardeep Patel, an Indian passport holder, Traveler, Blogger, Story Writer. I completed my M-Tech (Computer Science) in 2016. I love to travel, eat different foods from various cuisines, experience different cultures, make new friends and meet other.

Share this article

-- Advertisement --

LEAVE A REPLY

Please enter your comment!
Please enter your name here

-- Advertisement --