Markdown Syntax
This document describes some of the more important parts of Markdown (for writers, that is). There's a lot more to the syntax than is mentioned here, though. To get the full syntax documentation, go to John Gruber's Markdown Syntax page
Headers
For top-level headers underline the text with equal signs. For second-level headers use dashes to underline.
This is an H1 =============
This is an H1
This is an H2 -------------
This is an H2
If you would rather, you can prefix headers with a hash (#) symbol instead. The number of hash symbols indicates the header level. For example, a single hash indicates a header level of one while two indicates the second header level:
# This is an H1 ## This is an H2 ### This is an H3
This is an H1
This is an H2
This is an H3
Which you choose is a matter of style. Whichever you thinks looks better in the text document. In both cases, the final, fully formatted, document looks the same.
Paragraphs
Paragraphs are surrounded by blank lines.
This is paragraph one. This is paragraph two.
This is paragraph one.
This is paragraph two.
Links
There are two parts to every link. The first is the actual text that the user will see and it is surrounded by brackets. The second is address of the page you wish to link to and it is surrounded in parenthesis.
[link text](http://example.com/)
Formatting
To indicate bold text surround the text with two star (*) symbols or two underscore (_) symbols:
**This is bold** __This is also bold__
This is bold
This is also bold
To indicate italicized text surround the text with a single star (*) symbol or underscore (_) symbol:
*This is italics* _This is also italics_
This is italics
This is also italics
To indicate italicized and bold text surround the text with three star (*) symbol or underscore (_) symbol:
***This is bold and italics*** ___This is also bold and italics___
This is bold and italics
This is also bold and italics
Blockquotes
To create an indented area use the right angle bracket (>) character before each line to be included in the blockquote.
> This is part of a blockquote. > This is part of the same blockquote.
This is part of a blockquote.
This is part of the same blockquote.
Rather than putting it in front of each line to include in the block quote you can put it at the beginning and end the quote with a newline.
> This is part of a blockquote. This continues the blockquote even though there's no bracket. The blank line ends the blockquote.
This is part of a blockquote. This continues the blockquote even though there's no bracket.
The blank line ends the blockquote.
Lists
To create a numbered list in Markdown, prefix each item in the list with a number followed by a period and space. The number you use actually doesn't matter.
1. Item 1 2. Item 2 3. Item 3
- Item 1
- Item 2
- Item 3
To create a bulleted list, prefix each item in the list with a star (*) character.
* A list item * Another list item * A third list item
- A list item
- Another list item
- A third list item
Code
Surround code within a sentence with backticks (`). For a block of code, put three backticks on the lines before and after it; the name of the language after the first three gives it the right colours.
Use the `read.csv()` function:
```r
data <- read.csv("plots.csv")
```Use the read.csv() function:
data <- read.csv("plots.csv")Tables
Separate the cells with vertical bars (|) and put a line of dashes under the header row. A colon on the right of the dashes aligns the column to the right, on both sides centres it.
| Plot | Trees | | ---- | ----: | | A1 | 12 | | B2 | 7 |
| Plot | Trees |
|---|---|
| A1 | 12 |
| B2 | 7 |
The editor
The buttons above the text box add the Markdown for you. Their keyboard shortcuts (Cmd instead of Ctrl on a Mac):
| Keys | Does |
|---|---|
| Ctrl+B | Bold |
| Ctrl+I | Italic |
| Ctrl+K | Link |
| Ctrl+E | Inline code |
| Ctrl+Z, Ctrl+Y | Undo, redo |
| Ctrl+Shift+V | Paste as plain text |
| Ctrl+Enter | Post |
| Tab, Shift+Tab | Indent or outdent list items and code |
| Esc, then Tab | Leave the text box (Tab elsewhere leaves it too) |
In the toolbar, the arrow keys move between the buttons. Enter after a list item starts the next one; Enter on an empty item ends the list.
Paste or drop images into the text box to upload them, or use the image button. Text pasted from a web page or a document keeps its links, bold and italic text, lists, headings, code and tables, written as Markdown.
A Lot More
There's a lot more to the Markdown syntax than is mentioned here. But for creative writers, this covers a lot of the necessities. To find out more about Markdown than you'd ever want to really know, go to the Markdown page where it all started.