Headings
To create a heading, add number signs ( #
) in front of a word or phrase. The number of number signs you use should correspond to the heading level. For example, to create a heading level three ( <h3>
), use three number signs (e.g., ### My Header
).
# Heading level 1
## Heading level 2
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6
Alternatively, on the line below the text, add any number of ==
characters for heading level 1 or --
characters for heading level 2.
Heading level 1
===============
Heading level 2
---------------
|
Markdown applications don’t agree on how to handle a missing space between the number signs ( #
) and the heading name. For compatibility, always put a space between the number signs and the heading name.
You should also put blank lines before and after a heading for compatibility
Paragraphs
To create paragraphs, use a blank line to separate one or more lines of text. |
Unless the paragraph is in a list, don’t indent paragraphs with spaces or tabs.
Line Breaks
To create a line break or new line ( <br>
), end a line with two or more spaces, and then type return.
You can use two or more spaces (commonly referred to as “trailing white space”) for line breaks in nearly every Markdown application, but it’s controversial. It’s hard to see trailing white space in an editor, and many people accidentally or intentionally put two spaces after every sentence. For this reason, you may want to use something other than trailing white space for line breaks. If your Markdown application supports HTML, you can use the <br>
HTML tag. |
For compatibility, use trailing white space or the <br>
HTML tag at the end of the line.
CommonMark and a few other lightweight markup languages let you type a backslash (`\`) at the end of the line, but not all Markdown applications support this, so it isn’t a great option from a compatibility perspective.
And at least a couple lightweight markup languages don’t require anything at the end of the line - just type return and they’ll create a line break.
Ordered Lists
To create an ordered list, add line items with numbers followed by periods. The numbers don’t have to be in numerical order, but the list should start with the number one.
1. First item
2. Second item
3. Third item
1. Indented item
2. Indented item
4. Fourth item
|
CommonMark and a few other lightweight markup languages let you use a parenthesis ( )
) as a delimiter (e.g., 1) First item
), but not all Markdown applications support this, so it isn’t a great option from a compatibility perspective. For compatibility, use periods only.
Unordered Lists
To create an unordered list, add dashes ( -
), asterisks ( *
), or plus signs ( +
) in front of line items. Indent one or more items to create a nested list.
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
+ First item
+ Second item
+ Third item
+ Indented item
+ Indented item
+ Fourth item
* First item
* Second item
* Third item
* Indented item
* Indented item
* Fourth item
Starting Unordered List Items With Numbers
If you need to start an unordered list item with a number followed by a period, you can use a backslash (`\`) to escape the period.
- 1968\. A great year!
- I think 1969 was second best.
|
Markdown applications don’t agree on how to handle different delimiters in the same list. For compatibility, don’t mix and match delimiters in the same list — pick one and stick with it.
Adding Elements in Lists
To add another element in a list while preserving the continuity of the list, indent the element four spaces or one tab, as shown in the following examples.
Paragraphs
* This is the first list item.
* Here's the second list item.
`
I need to add another paragraph below the second list item.
* And here's the third list item.
Blockquotes
* This is the first list item.
* Here's the second list item.
> A blockquote would look great below the second list item.
* And here's the third list item.
Code blocks
Code blocks are normally indented four spaces or one tab. When they’re in a list, indent them eight spaces or two tabs.
1. Open the file.
2. Find the following code block on line 21:
<html>
<head>
<title>Test</title>
</head>
3. Update the title to match the name of your website.
Images
1. Open the file containing the Linux mascot.
2. Marvel at its beauty.
!Tux, the Linux mascot
3. Close the file.
Lists
You can nest an unordered list in an ordered list, or vice versa.
1. First item
2. Second item
3. Third item
- Indented item
- Indented item
4. Fourth item
|
|
|
Bold
To bold text, add two asterisks or underscores before and after a word or phrase. To bold the middle of a word for emphasis, add two asterisks without spaces around the letters.
I just love **bold text**.
I just love __bold text__.
Love**is**bold
|
Markdown applications don’t agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to bold the middle of a word for emphasis.
Italic
To italicize text, add one asterisk or underscore before and after a word or phrase. To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters.
Italicized text is the *cat's meow*.
Italicized text is the _cat's meow_.
A*\cat*meow.
|
Markdown applications don’t agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to italicize the middle of a word for emphasis.
Bold and Italic
To emphasize text with bold and italics at the same time, add three asterisks or underscores before and after a word or phrase. To bold and italicize the middle of a word for emphasis, add three asterisks without spaces around the letters.
This text is ***really important***.
This text is ___really important___.
This text is __*really important*__.
This text is **_really important_**.
This is really***very***important text.
|
The order of the em and strong tags might be reversed depending on the Markdown processor you're using.
Markdown applications don’t agree on how to handle underscores in the middle of a word. For compatibility, use asterisks to bold and italicize the middle of a word for emphasis.
Blockquote
To create a blockquote, add a >
in front of a paragraph.
> This is a blockquote.
Blockquotes with Multiple Paragraphs
Blockquotes can contain multiple paragraphs. Add a >
on the blank lines between the paragraphs.
> This is a blockquote.
>
> Continuation of the blockquote.
Nested Blockquotes
Blockquotes can be nested. Add a >>
in front of the paragraph you want to nest.
> This is a blockquote.
>
>> This is a nested blockquote
Blockquotes with Other Elements
Blockquotes can contain other Markdown formatted elements. Not all elements can be used — you’ll need to experiment to see which ones work.
> #### Blockquote with heading!
>
> - List item inside blockquote.
> - List item inside blockquote.
>
> *Italic* and **bold** are also available.
|
For compatibility, put blank lines before and after blockquotes.
Horizontal Rules
To create a horizontal rule, use three or more asterisks ( ***
), dashes ( ---
), or underscores ( ___
) on a line by themselves.
***
---
_________________
|
For compatibility, put blank lines before and after horizontal rules.
|