Markdown is used a lot, so I figured a cheat sheet could be useful, so here goes:
Headings
Paragraphs
Horizontal Rule
Text Styling
Links
Named Anchors
Images
Lists
Quotes
Tables
Headings
Headings in Markdown are preceded by the octothorpe (#
). You can also add trailing octothorpes, but this is optional.
1 2 3 4 5 6 |
|
Another way to create heading 1 and heading 2 are with equal signs (=
) or dashes (-
) under the text you want in the header.
1 2 3 4 5 |
|
Paragraphs
Paragraphs are determined based off a new line or at least two spaces at the end of a line.
1 2 3 4 |
|
Horizontal Rule
You can break up paragraphs with a horizontal line.
Just do any of the following:
___
Three underscores
---
Three dashes
***
Three asterisks
Text Styling
For text styling, the asterisk (*
) or underscore(_
) is used.
Bold
To make an item bold, use two asterisks on each side of the item.
1 2 3 |
|
Italic
To make an item italic, use one asterisk on either side of the item.
1 2 3 |
|
Strikethrough
To strikethrough an item, use two tildes (~
) on either side of the item.
1 2 |
|
Escaping Characters
Some characters have meaning in Markdown, so when you want them to be displayed you may run into issues. You can escape these characters, so that you can display them without side-effects. To do so, put a backslash (\
) before the character.
1 2 |
|
The following characters have this property:
Symbol | Name |
---|---|
# | Octothorpe |
+ | Plus Sign |
- | Hyphen |
\ | Backslash |
` | Backtick |
* | Asterisk |
_ | Underscore |
{} | Curly Braces |
[] | Square Brackets |
() | Parentheses |
. | Period |
! | Excalamtion Point |
Links
For links, the text you want displayed is kept in brackets([]
), with the link kept in parentheses (()
). You can also include a title after the link, which generally appears as a tooltip. These links will open in the current tab, so if you want the link to open in a new window or tab, use the html syntax.
1 2 |
|
You can also use a reference style for links.
1 2 3 |
|
Named Anchors
If you want to create navigation from within the page, you can use named anchors, which is basically a link. At any headings that you want to be able to jump to, add <a id="named-anchors"></a>
so that the headings will look something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
You can also put the link of the line of the header, but this will bring you to the content and cut off the header. To create a link to each one of the headings you would do so in the same style as a normal link.
1 2 3 4 5 |
|
Images
Images are also similar to links. They use the same syntax, but have an exclamation point (!
) preceding them. The text in the brackets will act as the alternative text, should the image not be able to load. The text after the url is what will show up as a tooltip when the user hovers over the picture.
1
|
|
Small cell carcinoma - Yale Rosen
You can also use a reference syntax.
1 2 3 |
|
Hypersensitivity pneumonitis Case 127 - Yale Rosen
Lists
Unordered Lists
To create an unordered list use either an asterisk (*
), a plus sign (+
), or a hyphen (-
) followed by a space before each bullet.
1 2 3 4 5 6 7 8 |
|
- This is a bullet
- This is also a bullet
- This is a lower level
- Even lower
- And lower
- So low
- Almost through the earth
- So low
- And lower
- Even lower
- This is a lower level
- And back up
Ordered Lists
Ordered lists are pretty self explanatory. Simply precede each item in the list with the number or letter, followed by a period, followed by a space.
1 2 3 |
|
- This is the first item!
- And this is the second
- I think you get it. . .
The numbering you put doesn't necessarily affect the numbering. For instance:
1 2 3 4 |
|
Produces the following list:
- I'm number 1
- I'm number 2
- I'm letter A
- I'm number 64
Quotes
Quotes can be inserted by putting a greater than sign >
at the beginning of the line. To site the sourse, use the <cite>
tags.
1 2 |
|
My greatest pain in life is that I will never be able to see myself perform live. Kanye West
Code Snippets
Inline
To create an inline code snippet (like this!
), use the backtick (`
) on either side of the item.
1
|
|
Indented
You can create a code snippet through the use of indentation. Add four spaces to the beginning of a line of code for this to work.
1 2 |
|
This is code.
Am I right?
Block
To create block code, which is what I've been using for all of the code examples in this cheat sheet. To do this use three backticks on the top and bottom of the code snippet. Next to the top three backticks, you can specify the language that you are writing the code in so that the syntax will be higlighted appropriately. If you're not sure what code to use for a particular language, check out the short codes on this reference guide.
1 2 3 4 5 |
|
1 2 3 |
|
Tables
Tables can be created through the use of pipes (|
) to separate columns and dashes (-
) to separate the titles from the rows.
1 2 3 4 5 |
|
Id | Name | Description |
---|---|---|
1 | Elle Woods | Lawyer in pink |
2 | Emmett Forrest | Handsome husband |
3 | Bruiser Woods | Chic chihuahua |
By default, the table will be left aligned. If you want to center the items in the table, use colons (:
) as follows:
1 2 3 4 5 |
|
Id | Name | Description |
---|---|---|
1 | Elle Woods | Lawyer in pink |
2 | Emmett Forrest | Handsome husband |
3 | Bruiser Woods | Chic chihuahua |
You can also right align the information.
1 2 3 4 5 |
|
Id | Name | Description |
---|---|---|
1 | Elle Woods | Lawyer in pink |
2 | Emmett Forrest | Handsome husband |
3 | Bruiser Woods | Chic chihuahua |