Markdown

Basic Syntax

Headings

  • use hash signs (#) in front of a word or phrase.
  • number of hash signs specifies the heading level
Markdown
# Heading level 1

## Heading level 2

### Heading level 3

#### Heading level 4

##### Heading level 5

###### Heading level 6
Output

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Heading level 5
Heading level 6

Paragraph

  • Tabs and whitespace have a special meaning in Markdown
  • use trailing whitespace to create line breaks
  • for compatibility, use <br>
Do this
Don't put tabs or spaces in front of your paragraphs.<br>

Keep lines left-aligned like this.
Don't do this
   This can result in unexpected formatting problems.

   Don't add tabs or spaces in front of paragraphs.

Bold

  • add two asterisks (**) or underscores (__), without spaces, before and after a word or phrase
Markdown
Try **bold text** now.
Rendered Output

Try bold text now.

Italic

  • add one asterisk (*) or underscore (_), without spaces, before and after a word or phrase.
Markdown
Try *italic text* now.
Rendered Output

Try italic text now.

Bold and Italic

  • add three asterisks or underscores, without spaces, before and after a word or phrase
Markdown
Try ***italic and bold text*** now.
Rendered Output

Try italic and bold text now.

Ordered List

  • for compatibility, use periods only
Markdown
1. First item
1. Second item
1. Third item
Rendered Output
  1. First item
  2. Second item
  3. Third item

Nested Ordered List

  • indent one or more items to create a nested list
Markdown
1. First item
1. Second item
   1. Nested first item
   1. Nested second item
Rendered Output
  1. First item
  2. Second item
    1. Nested first item
    2. Nested second item

Unordered List

  • add dashes (-), asterisks (*), or plus signs (+) in front of line items
  • do not mix (-), (*), (+)
  • indent one or more items to create a nested list
Markdown
- First item
- Second item
* First item
* Second item
+ First item
+ Second item
Rendered Output
  • First item
  • Second item

Code

  • enclose a word of phrase in backticks (`)
Markdown
Declare a variable named `point`
Rendered Output

Declare a variable named point

Code Blocks

  • indent every line of the block by at least four spaces or one tab
  • or use fenced code block with three backticks (```) or ~~~
  • if syntax highlight is supported, add a language to fenced code block
Markdown
    import random

    print("Hello, world!")
```python
import random

print("Hello, world!")
```
Rendered Output
import random

print("Hello, world!")
import random
    
print("Hello, world!")

Horizontal Rules

  • use three or more asterisks (***), dashes (---), or underscores (___) on a line by themselves.
Markdown
First line.

---

Second line.
Rendered Output

First line.


Second line.

URLs and Email Addresses

  • enclose the link/email in angle brackets
Markdown
<https://github.com>

<username@cn330>

Images

  • add an exclamation mark (!)
  • followed by alt text in brackets
  • followed by the path or URL to the image in parentheses
  • optionally add a title in quotation marks after the path or URL
Markdown
![DevOps](img/devops.jpg "Title")
Rendered Output
DevOps

Linking Images

  • enclose the Markdown for the image in brackets
  • then add the link in parentheses.
Markdown
[![DevOps](img/devops.jpg "Title")](https://en.wikipedia.org/wiki/DevOps)
Rendered Output

DevOps

Escaping Characters

  • add a backslash (\) in front of the character
Markdown
\* Without the backslash, this would be a bullet in an unordered list.
Rendered Output

* Without the backslash, this would be a bullet in an unordered list.

References