--- 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 - /github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax versions: fpt: '*' ghes: '*' ghae: '*' ghec: '*' 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 hierarchy level and typeface size of the heading. ```markdown # A first-level heading ## A second-level heading ### A third-level heading ```  When you use two or more headings, GitHub automatically generates a table of contents that you can access by clicking {% octicon "list-unordered" aria-label="The unordered list icon" %} 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, strikethrough, subscript, or superscript text in comment fields and `.md` files. | Style | Syntax | Keyboard shortcut | Example | Output | | --- | --- | --- | --- | --- | | 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 | `~~ ~~` | None | `~~This was mistaken text~~` | ~~This was mistaken text~~ | | Bold and nested italic | `** **` and `_ _` | None | `**This text is _extremely_ important**` | **This text is _extremely_ important** | | All bold and italic | `*** ***` | None | `***All this text is important***` | ***All this text is important*** | | Subscript | ` ` | None | `This is a subscript text` | This is a subscript text | | Superscript | ` ` | None | `This is a superscript text` | This is a superscript text | ## Quoting text You can quote text with a >. ```markdown Text that is not a quote > Text that is a quote ``` Quoted text is indented, with a different type color.  {% 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 "[AUTOTITLE](/get-started/using-github/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. 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. ```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 ``` For more information, see "[AUTOTITLE](/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks)." {% data reusables.user-settings.enabling-fixed-width-fonts %} ## Supported color models In issues, pull requests, and discussions, you can call out colors within a sentence by using backticks. A supported color model within backticks will display a visualization of the color. ```markdown The background color is `#ffffff` for light mode and `#000000` for dark mode. ```  Here are the currently supported color models. | Color | Syntax | Example | Output | | --- | --- | --- | --- | | HEX |
\`#RRGGBB\` | \`#0969DA\` |  |
| RGB | \`rgb(R,G,B)\` | \`rgb(9, 105, 218)\` |  |
| HSL | \`hsl(H,S,L)\` | \`hsl(212, 92%, 45%)\` |  |
{% note %}
**Notes:**
- A supported color model cannot have any leading or trailing spaces within the backticks.
- The visualization of the color is only supported in issues, pull requests, and discussions.
{% endnote %}
## Links
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.
You can also create a Markdown hyperlink by highlighting the text and using the keyboard shortcut Command+V. If you'd like to replace the text with the link, use the keyboard shortcut Command+Shift+V.
`This site was built using [GitHub Pages](https://pages.github.com/).`

{% tip %}
**Tip:** {% data variables.product.product_name %} automatically creates links when valid URLs are written in a comment. For more information, see "[AUTOTITLE](/get-started/writing-on-github/working-with-advanced-formatting/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 `[ ]`. Alt text is a short text equivalent of the information in the image. Then, wrap the link for the image in parentheses `()`.
``

{% data variables.product.product_name %} supports embedding images into your issues, pull requests{% ifversion fpt or ghec %}, 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 that is in your repository, 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?raw=true` |
| 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 that contains these images.
{% endnote %}
For more information, see "[Relative Links](#relative-links)."
### Specifying the theme an image is shown to
You can specify the theme an image is displayed for in Markdown by using the HTML `<!-- This content will not appear in the rendered Markdown -->## 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\*.`  For more information on backslashes, see Daring Fireball's "[Markdown Syntax](https://daringfireball.net/projects/markdown/syntax#backslash)." {% tip %} **Note**: The Markdown formatting will not be ignored in the title of an issue or a pull request. {% endtip %} ## Disabling Markdown rendering {% data reusables.repositories.disabling-markdown-rendering %} ## Further reading - [{% data variables.product.prodname_dotcom %} Flavored Markdown Spec](https://github.github.com/gfm/) - "[AUTOTITLE](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/about-writing-and-formatting-on-github)" - "[AUTOTITLE](/get-started/writing-on-github/working-with-advanced-formatting)" - "[AUTOTITLE](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/quickstart-for-writing-on-github)"