Syntax
Back to markdownMarkdown is a lightweight markup language that allows you to format text easily without using complex HTML. Markdown is commonly used in:
- GitHub
- Blogs
- Documentation
- CMS platforms
- README files
- Static site generators
This article summarizes the most common Markdown syntax.
Headings
Markdown supports six levels of headings.
# Heading 1 ## Heading 2 ### Heading 3 #### Heading 4 ##### Heading 5 ###### Heading 6
Rendered result:
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Paragraph
Just write normal text.
This is a paragraph. This is another paragraph.
Line Break
You can create a line break by adding two spaces at the end of a line.
Line 1 Line 2
Bold
**Bold text** __Bold text__
Rendered result:
Bold text
Italic
*Italic text* _Italic text_
Rendered result:
Italic text
Bold and Italic
***Bold and italic***
Rendered result:
Bold and italic
Strikethrough
~~Strikethrough text~~
Rendered result:
Blockquote
> This is a blockquote
Rendered result:
> This is a blockquote
Nested blockquotes:
> Level 1 >> Level 2 >>> Level 3
Unordered List
- Item 1 - Item 2 - Item 3
Or
* Item 1 * Item 2 * Item 3
Rendered result:
- Item 1
- Item 2
- Item 3
Ordered List
1. Item 1 2. Item 2 3. Item 3
Rendered result:
- Item 1
- Item 2
- Item 3
Nested List
1. Item 1 - Sub item - Sub item 2. Item 2
Rendered result:
- Item 1
- Sub item
- Sub item
- Item 2
Inline Code
Use `inline code`
Rendered result:
Use
inline codeCode Block
```
console.log("Hello Markdown")
```
Rendered result:
console.log("Hello Markdown")
Code Block with Syntax Highlighting
```javascript
function hello() {
console.log("Hello world");
}
```
function hello() { console.log("Hello world"); }
Link
[Google](https://google.com)
Rendered result:
Reference Link
[Google][1] [1]: https://google.com
Image

Example:

Image with Link
[](https://example.com)
Horizontal Line
---
Or
***
Rendered result:
Table
| Name | Age | Job | |------|-----|-----| | John | 25 | Dev | | Anna | 22 | Designer |
Rendered result:
| Name | Age | Job |
|---|---|---|
| John | 25 | Dev |
| Anna | 22 | Designer |
Table Alignment
| Name | Age | Job | |:-----|:---:|----:| | John | 25 | Dev |
Explanation:
| Syntax | Alignment |
|---|---|
| :--- | Left |
| :---: | Center |
| ---: | Right |
Task List (Checklist)
- [x] Completed - [ ] Not completed
Rendered result:
- [x] Completed
- [ ] Not completed
Escape Characters
*Not italic*
Rendered result:
Not italic
HTML in Markdown
Markdown also supports HTML.
<b>Bold using HTML</b>
Footnotes
This is a footnote[^1] [^1]: Footnote content
Definition List
Markdown : A lightweight markup language
Emoji
:smile: :rocket: :fire:
Rendered result:
😄 🚀 🔥
Automatic URL
<https://google.com>
Rendered result:
Highlight
Some Markdown engines support:
==highlight==
Subscript and Superscript
H~2~O X^2^
Mathematical Formula (MathJax)
$$ E = mc^2 $$
Diagram (Mermaid)
GitHub supports Mermaid diagrams.
```mermaid graph TD A[Start] --> B[Process] B --> C[End] ```