-
Notifications
You must be signed in to change notification settings - Fork 57
Markdown Reference
A complete reference for all Markdown syntax supported by Markdown Viewer, implementing CommonMark plus GitHub Flavored Markdown (GFM) extensions.
- Headings
- Paragraphs & Line Breaks
- Emphasis
- Blockquotes
- Lists
- Task Lists
- Code
- Horizontal Rules
- Links
- Images
- Tables
- Footnotes
- HTML
- Math (LaTeX)
- Mermaid Diagrams
- Emoji
- Strikethrough
- Escaping Characters
- Security Notes
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6Alternative syntax for H1 and H2:
Heading 1
=========
Heading 2
---------A blank line separates paragraphs.
Two trailing spaces or a backslash \ at the end of a line creates a line break within a paragraph.
First paragraph.
Second paragraph.
Line one
Line two (two trailing spaces before newline)
Line one\
Line two (backslash before newline)| Syntax | Output |
|---|---|
*italic* or _italic_
|
italic |
**bold** or __bold__
|
bold |
***bold italic*** |
bold italic |
~~strikethrough~~ |
> This is a blockquote.
>
> It can span multiple paragraphs.
> Nested blockquote:
>> Second level
>>> Third level- Item one
- Item two
- Nested item
- Another nested item
- Item threeYou can also use * or + as list markers.
1. First item
2. Second item
1. Nested ordered item
3. Third itemNumbers do not need to be sequential; they are always rendered in order.
Add blank lines between items to create "loose" (paragraph-spaced) lists:
- Item one
- Item two
- Item threeGitHub Flavored Markdown task lists:
- [x] Completed task
- [ ] Incomplete task
- [x] Another completed taskCheckboxes are rendered as interactive HTML checkboxes in the preview.
Use `backticks` for inline code.Use triple backticks with an optional language identifier:
```javascript
const greet = (name) => `Hello, ${name}!`;
console.log(greet("World"));
```Indent 4 spaces to create a code block (no syntax highlighting):
function example() {
return true;
}Use three or more hyphens, asterisks, or underscores on a line by themselves:
---
***
___[Link text](https://example.com)
[Link with title](https://example.com "Title")[Link text][reference-id]
[reference-id]: https://example.com "Optional Title"URLs and email addresses surrounded by angle brackets become links:
<https://example.com>
<user@example.com>Bare URLs are also automatically linked:
https://example.com
Reference-style images:
![Alt text][image-ref]
[image-ref]: https://example.com/image.png "Title"GFM tables use pipe characters and hyphens:
| Header 1 | Header 2 | Header 3 |
|----------|:--------:|---------:|
| Left | Center | Right |
| Cell | Cell | Cell |Column alignment is set by the colon position in the separator row:
| Syntax | Alignment |
|---|---|
--- |
Left (default) |
:---: |
Center |
---: |
Right |
:--- |
Left (explicit) |
Here is a sentence with a footnote.[^1]
[^1]: This is the footnote content.Multi-paragraph footnotes:
[^long]: Footnote paragraph one.
Footnote paragraph two (indented 4 spaces).Raw HTML is supported and renders as-is (after DOMPurify sanitization):
<div style="color: red;">
This text is red.
</div>
<details>
<summary>Click to expand</summary>
Hidden content here.
</details>Note: Some HTML attributes may be stripped by DOMPurify for security.
Requires MathJax (enabled by default).
Einstein's equation: $E = mc^2$
The Pythagorean theorem: $a^2 + b^2 = c^2$$$
\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}
$$| Command | Output |
|---|---|
\frac{a}{b} |
Fraction |
\sqrt{x} |
Square root |
x^{n} |
Superscript |
x_{n} |
Subscript |
\int_a^b |
Integral |
\sum_{i=0}^n |
Summation |
\alpha, \beta, \gamma |
Greek letters |
\mathbf{v} |
Bold vector |
\begin{matrix}…\end{matrix} |
Matrix |
Wrap Mermaid syntax in a fenced code block with the mermaid language identifier.
```mermaid
flowchart TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
``````mermaid
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop HealthCheck
John->>John: Fight against hypochondria
end
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
``````mermaid
gantt
title A Gantt Diagram
dateFormat YYYY-MM-DD
section Section
Task A :a1, 2024-01-01, 30d
Task B :after a1, 20d
section Another Section
Task C :2024-01-12, 12d
Task D :24d
``````mermaid
classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Duck: +String beakColor
Duck: +quack()
Fish: -int sizeInFeet
Fish: -canEat()
```Use GitHub-style emoji shortcodes:
:smile: :thumbsup: :rocket: :warning: :white_check_mark:Renders as: 😄 👍 🚀
A full list of supported shortcodes is available at emoji.joypixels.com.
GFM extension:
~~This text is struck through~~Use a backslash to escape Markdown special characters:
\*Not italic\*
\# Not a heading
\[Not a link\]
\`Not code\`Escapable characters: \ * _ { } [ ] ( ) # + - . ! |
- Sanitized HTML: Raw HTML is sanitized with DOMPurify to remove unsafe tags and attributes.
-
No script execution:
<script>tags and inline event handlers are stripped for safety. - Local processing: Markdown rendering happens entirely in the browser with no server-side processing.