--- title: Basic writing and formatting syntax intro: Create sophisticated formatting for your prose and code on GitHub with simple syntax. redirect_from: - /articles/basic-writing-and-formatting-syntax - /github/writing-on-github/basic-writing-and-formatting-syntax versions: fpt: '*' ghes: '*' ghae: '*' shortTitle: Basic 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. ```markdown # The largest heading ## The second largest heading ###### The smallest heading ``` ![Rendered H1, H2, and H6 headings](/assets/images/help/writing/headings-rendered.png) ## Styling text You can indicate emphasis with bold, italic, or strikethrough text in comment fields and `.md` files. | Style | Syntax | Keyboard shortcut | Example | Output | | --- | --- | --- | --- | --- | | Bold | `** **` or `__ __` | command/control + b | `**This is bold text**` | **This is bold text** | | Italic | `* *` or `_ _` | command/control + i | `*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 `>`. ```markdown In the words of Abraham Lincoln: > Pardon my French ``` ![Rendered quoted text](/assets/images/help/writing/quoted-text-rendered.png) {% tip %} **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 {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %}, then **Quote reply**. For more information about keyboard shortcuts, see "[Keyboard shortcuts](/articles/keyboard-shortcuts/)." {% endtip %} ## 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.{% ifversion fpt or ghae-next or ghes > 3.1 %} You can also press the `command` or `Ctrl` + `e` keyboard shortcut to insert the backticks for a code block within a line of Markdown.{% endif %} ```markdown Use `git status` to list all new or modified files that haven't yet been committed. ``` ![Rendered inline code block](/assets/images/help/writing/inline-code-rendered.png) To format code or text into its own distinct block, use triple backticks.
Some basic Git commands are:
```
git status
git add
git commit
```
![Rendered code block](/assets/images/help/writing/code-block-rendered.png) For more information, see "[Creating and highlighting code blocks](/articles/creating-and-highlighting-code-blocks)." ## Links You can create an inline link by wrapping link text in brackets `[ ]`, and then wrapping the URL in parentheses `( )`. {% ifversion fpt or ghae-next or ghes > 3.1 %}You can also use the keyboard shortcut `command + k` to create a link.{% endif %} `This site was built using [GitHub Pages](https://pages.github.com/).` ![Rendered link](/assets/images/help/writing/link-rendered.png) {% tip %} **Tip:** {% data variables.product.product_name %} automatically creates links when valid URLs are written in a comment. For more information, see "[Autolinked references and URLs](/articles/autolinked-references-and-urls)." {% endtip %} ## Section links {% data reusables.repositories.section-links %} ## Relative links {% data reusables.repositories.relative-links %} ## 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)` ![Rendered Image](/assets/images/help/writing/image-rendered.png) {% data variables.product.product_name %} supports embedding images into your issues, pull requests{% ifversion fpt %}, discussions{% endif %}, comments and `.md` files. You can display an image from your repository, add a link to an online image, or upload an image. For more information, see "[Uploading assets](#uploading-assets)." {% tip %} **Tip:** When you want to display an image which is in your repository, you should use relative links instead of absolute links. {% endtip %} Here are some examples for using relative links to display an image. | Context | Relative 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 %} **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. {% endnote %} For more information, see "[Relative Links](#relative-links)." ## Lists You can make an unordered list by preceding one or more lines of text with `-` or `*`. ```markdown - George Washington - John Adams - Thomas Jefferson ``` ![Rendered unordered list](/assets/images/help/writing/unordered-list-rendered.png) To order your list, precede each line with a number. ```markdown 1. James Madison 2. James Monroe 3. John Quincy Adams ``` ![Rendered ordered list](/assets/images/help/writing/ordered-list-rendered.png) ### 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 {% data variables.product.product_name %} or a text editor that uses a monospaced font, like [Atom](https://atom.io/), 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. ```markdown 1. First list item - First nested list item - Second nested list item ``` ![Nested list with alignment highlighted](/assets/images/help/writing/nested-list-alignment.png) ![List with two levels of nested items](/assets/images/help/writing/nested-list-example-1.png) To create a nested list in the comment editor on {% data variables.product.product_name %}, 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`. ```markdown 100. First list item - First nested list item ``` ![List with a nested list item](/assets/images/help/writing/nested-list-example-3.png) You can create multiple levels of nested lists using the same method. For example, because the first nested list item has seven spaces (`␣␣␣␣␣-␣`) before the nested list content `First nested list item`, you would need to indent the second nested list item by seven spaces. ```markdown 100. First list item - First nested list item - Second nested list item ``` ![List with two levels of nested items](/assets/images/help/writing/nested-list-example-2.png) For more examples, see the [GitHub Flavored Markdown Spec](https://github.github.com/gfm/#example-265). ## Task lists {% data reusables.repositories.task-list-markdown %} If a task list item description begins with a parenthesis, you'll need to escape it with `\`: `- [ ] \(Optional) Open a followup issue` For more information, see "[About task lists](/articles/about-task-lists)." ## Mentioning people and teams You can mention a person or [team](/articles/setting-up-teams/) on {% data variables.product.product_name %} 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. For more information about notifications, see {% ifversion fpt or ghes or ghae %}"[About notifications](/github/managing-subscriptions-and-notifications-on-github/about-notifications){% else %}"[About notifications](/github/receiving-notifications-about-activity-on-github/about-notifications){% endif %}." `@github/support What do you think about these updates?` ![Rendered @mention](/assets/images/help/writing/mention-rendered.png) When you mention a parent team, members of its child teams also receive notifications, simplifying communication with multiple groups of people. For more information, see "[About teams](/articles/about-teams)." 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. For more information, see "[Autolinked references and URLs](/articles/autolinked-references-and-urls)." ## Referencing external resources {% data reusables.repositories.autolink-references %} ## Content attachments Some {% data variables.product.prodname_github_apps %} provide information in {% data variables.product.product_name %} for URLs that link to their registered domains. {% data variables.product.product_name %} renders the information provided by the app under the URL in the body or comment of an issue or pull request. ![Content attachment](/assets/images/github-apps/content_reference_attachment.png) To see content attachments, you must have a {% data variables.product.prodname_github_app %} that uses the Content Attachments API installed on the repository.{% ifversion fpt %} For more information, see "[Installing an app in your personal account](/articles/installing-an-app-in-your-personal-account)" and "[Installing an app in your organization](/articles/installing-an-app-in-your-organization)."{% endif %} Content attachments will not be displayed for URLs that are part of a markdown link. For more information about building a {% data variables.product.prodname_github_app %} that uses content attachments, see "[Using Content Attachments](/apps/using-content-attachments)." ## 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:` ![Rendered emoji](/assets/images/help/writing/emoji-rendered.png) 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](https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md). ## Paragraphs You can create a new paragraph by leaving a blank line between lines of text. ## Ignoring Markdown formatting You can tell {% data variables.product.product_name %} to ignore (or escape) Markdown formatting by using `\` before the Markdown character. `Let's rename \*our-new-project\* to \*our-old-project\*.` ![Rendered escaped character](/assets/images/help/writing/escaped-character-rendered.png) For more information, see Daring Fireball's "[Markdown Syntax](https://daringfireball.net/projects/markdown/syntax#backslash)." ## Further reading - [{% data variables.product.prodname_dotcom %} Flavored Markdown Spec](https://github.github.com/gfm/) - "[About writing and formatting on GitHub](/articles/about-writing-and-formatting-on-github)" - "[Working with advanced formatting](/articles/working-with-advanced-formatting)" - "[Mastering Markdown](https://guides.github.com/features/mastering-markdown/)"