Markdown
Headings
To create a heading, add up to six # symbols before your heading text. The number of # symbols determines the size of the heading.
Example
h1 Heading
h2 Heading
h3 Heading
h4 Heading
h5 Heading
h6 Heading
# h1 Heading
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading
Text Formatting
Text formatting can be achieved by wrapping the text on both ends with *, , *, __, or ~~ characters.
Example
Italic
Bold
Bold and italic
Underlined
Strikethrough
*Italic*
**Bold**
***_*Bold and italic*_***
__Underlined__
~~Strikethrough~~
Links
Inline links
To create an inline link, surround the link text in brackets ([ ]), and then the URL in parentheses (( )). URLs and URLs in between a pair of less-than and greater-than symbols (< >) will also automatically get turned into links.
Example
Plain URL: https://example.com
URL between less-than and greater-than symbols: https://example.com
[Inline external link](https://google.com)
[Inline relative link](./index.html)
Plain URL: https://example.com
URL between less-than and greater-than symbols: <https://example.com>
Reference-style links
Example
[Reference-style link][Reference]
[Direct reference-style link]
[Reference]: https://mozilla.org
[Direct reference-style link]: https://google.com
Code and syntax highlighting
You can format code both inline within a sentence, or in its own block.
Inline code snippet
Text inside a pair of backticks (`) will be formatted like code.
Example
This is an inline code snippet.
This is an `inline code snippet`.
Fenced code block
To format a block of code, surround the code with triple backticks (```). Code highlighting is enabled by specifying the language immediately after the opening triple backticks.
Example
using System;
class Program
{
static void Main()
{
Console.WriteLine("Welcome!");
// Generate a random number
Random random = new Random();
int randomNumber = random.Next(1, 100);
// Check if the number is even or odd
if (randomNumber % 2 == 0) {
Console.WriteLine($"The random number {randomNumber} is even.");
}
else
{
Console.WriteLine($"The random number {randomNumber} is odd.");
}
}
}
```csharp
using System;
class Program
{
static void Main()
{
Console.WriteLine("Welcome!");
// Generate a random number
Random random = new Random();
int randomNumber = random.Next(1, 100);
// Check if the number is even or odd
if (randomNumber % 2 == 0)
{
Console.WriteLine($"The random number {randomNumber} is even.");
}
else
{
Console.WriteLine($"The random number {randomNumber} is odd.");
}
}
}
```
Lists
Ordered lists
To create an ordered list, start a line with a sequence of 1-9 arabic digits (0-9), followed by either a . or ) character.
Example
- The first ordered list item
- Another item
- Indent by 3 spaces to create a sub-list item
- Sub-sub-list item
- Indent by 3 spaces to create a sub-list item
1. The first ordered list item
2. Another item
1. Indent by 3 spaces to create a sub-list item
1. Sub-sub-list item
Unordered lists
To create an unordered list, start a line with *, -, or +.
Example
- Used asterisk
- Used minus
- Used plus
- Indent by 3 spaces to create a sub-list item
- It is recommended that the same marker character is used for the entire list to maintain compatibility with other markdown parsers
- Indent by 3 spaces to create a sub-list item
* Used asterisk
- Used minus
+ Used plus
+ Indent by 3 spaces to create a sub-list item
+ It is recommended that the same marker character is used for the entire list to maintain compatibility with other markdown parsers
Task lists
To create a task list, start each list item with a hyphen (-) followed by a space and either [ ] to indicate an unchecked item or [x] to indicate a checked item.
Example
- Completed task
- Create a sub-task list item by indenting 3 spaces
- Incomplete task
- Formatting, links,
inline codeandtagsare supported
- [x] Completed task
- [x] Create a sub-task list item by indenting 3 spaces
- [ ] Incomplete task
- [ ] **Formatting**, [links](https://google.com), `inline code` and <del>tags</del> are supported
Nesting lists
It is possible to nest different list types together.
Example
- Unordered list item
- Ordered list item
- Completed task
- Ordered list item
- Incomplete task
- Ordered list item
- Unordered list item
1. Ordered list item
- [x] Completed task
2. Ordered list item
- [ ] Incomplete task
Images
(Work-in-progress)
Footnotes
(Work-in-progress)
Tables
Basic tables
To create a table, use vertical bars (|) and hyphens (-). Vertical bars separate columns, and hyphens define the column header. At least 3 hyphens are required. Outer vertical bars are optional. It it not necessary to align the vertical bars in markdown.
Example
| First name | Last name |
|---|---|
| Max | Planck |
| Marie | Curie |
<!-- All three markdown examples produce the same table above -->
| First name | Last name |
| ---------- | --------- |
| Max | Planck |
| Marie | Curie |
| First name | Last name |
| ---------- | --------- |
| Max | Planck |
| Marie | Curie |
| First name | Last name |
| ---------- | ------------------ |
| Max | Planck |
| Marie | Curie |
Formatting tables
Text formatting, links and inline code snippets are supported within tables.
Example
| Command | Description |
|---|---|
git status | List all new or modified files |
git diff | Show file differences that haven’t been staged |
git rebase | See usage notes |
| Command | Description |
| --- | --- |
| `git status` | List all *new or modified* files |
| `git diff` | Show file differences that **haven't been** staged |
| `git rebase` | [See usage notes](https://google.com) |
To left-align, center-align or right-align all text in a column, add a colon (:) immediately before the hyphens, on each end of the hyphens or immediately after the hyphens respectively.
Example
| Left-aligned | Center-aligned | Right-aligned |
|---|---|---|
| Content | Content | Content |
| Left-aligned | Center-aligned | Right-aligned |
| :--- | :---: | ---: |
| Content | Content | Content |
Blockquotes
To create a blockquote, add greater-than symbols (>) before the text.
Example
Blockquotes are very handy in email to emulate reply text. This line is part of the same quote.
Quote break.
This is a very long line that will still be quoted properly when it wraps. Oh boy let’s keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can put Markdown into a blockquote.
Blockquotes can also be nested…
…by using additional greater-than signs right next to each other…
…or with spaces between arrows.
> Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can _put_ **Markdown** into a blockquote.
> Blockquotes can also be nested...
>
> > ...by using additional greater-than signs right next to each other...
> >
> > > ...or with spaces between arrows.
HTML
HTML in Markdown
HTML can be directly authored in the Markdown document.
Example
- Definition list
- Is something people use sometimes.
- Markdown in HTML
- Does *not* work **very** well. Use HTML tags.
<dl>
<dt>Definition list</dt>
<dd>Is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
Preserving styles
By default, HTML parsed from Markdown is styled according to the CSS class prose assigned to the document body. To exclude authored HTML from inheriting these styles, add not-prose class.
Example
<div class="not-prose">...
</div>