Markdown Syntax Guide

Complete Markdown syntax reference for writing beautifully formatted documents

Markdown is a lightweight markup language that lets you format documents with simple text symbols. Its syntax is concise and intuitive, with a gentle learning curve, making it ideal for technical documentation, blog posts, and note-taking. This guide covers all Markdown syntax supported by MarkPDF.

Headings

Use # symbols to create headings, the number of # indicates heading level, from H1 to H6

Markdown
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
Rendered
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

Paragraphs and Line Breaks

Separate paragraphs with blank lines. For line breaks within a paragraph, add two spaces at the end of the line before pressing enter

Markdown
This is paragraph one.

This is paragraph two.

Line one with two spaces at end  
Line two (soft break)
Rendered
<p>This is paragraph one.</p>
<p>This is paragraph two.</p>
<p>Line one with two spaces at end<br>
Line two (soft break)</p>

Emphasis

Use asterisks or underscores around text to add emphasis effects

Markdown
*Italic* or _italic_
**Bold** or __bold__
***Bold and italic***
~~Strikethrough~~
Rendered
<em>Italic</em>
<strong>Bold</strong>
<strong><em>Bold and italic</em></strong>
<del>Strikethrough</del>

Lists

Supports ordered lists, unordered lists, and nested lists

Markdown
Unordered list:
- Item 1
- Item 2
  - Nested item
  - Another nested

Ordered list:
1. First
2. Second
3. Third
Rendered
<ul>
<li>Item 1</li>
<li>Item 2
  <ul>
  <li>Nested item</li>
  <li>Another nested</li>
  </ul>
</li>
</ul>
<ol>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>

Code

Use backticks for inline code, use triple backticks for code blocks

Markdown
Inline `code` in text.

```javascript
function hello() {
  console.log("Hello!");
}
```
Rendered
<code>code</code>
<pre><code class="language-javascript">
function hello() {
  console.log("Hello!");
}
</code></pre>

Tables

Use pipes and dashes to create tables, supports alignment settings

Markdown
| Header 1 | Header 2 | Header 3 |
|----------|:--------:|---------:|
| Left     | Center   | Right    |
| Cell     | Cell     | Cell     |
Rendered
<table>
<thead><tr>
<th>Header 1</th>
<th align="center">Header 2</th>
<th align="right">Header 3</th>
</tr></thead>
<tbody>
<tr><td>Left</td><td>Center</td><td>Right</td></tr>
<tr><td>Cell</td><td>Cell</td><td>Cell</td></tr>
</tbody>
</table>

Blockquotes

Use > symbol to create quote blocks, can be nested

Markdown
> This is a blockquote.
> It can span multiple lines.
>
> > Nested blockquote
Rendered
<blockquote>
<p>This is a blockquote.
It can span multiple lines.</p>
<blockquote><p>Nested blockquote</p></blockquote>
</blockquote>

Horizontal Rules

Use three or more dashes, asterisks, or underscores to create horizontal dividers

Markdown
---
***
___
Rendered
<hr>

Escape Characters

Use backslash to escape special characters, displaying them as plain text

Markdown
\*Not italic\*
\# Not a heading
\[Not a link\]
Rendered
*Not italic*
# Not a heading
[Not a link]