Guide de syntaxe Markdown

Référence complète de la syntaxe Markdown pour rédiger des documents bien mis en forme

Markdown est un langage de balisage léger : quelques symboles simples suffisent pour transformer du texte en titres, listes et tableaux. Ses règles sont faciles et vite apprises, d’où son succès pour les notes, les devoirs et la documentation technique. Ce guide couvre toute la syntaxe Markdown prise en charge par MarkPDF.

Titres

Le symbole # crée un titre ; le nombre de # fixe le niveau, de H1 à H6

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

Paragraphes et sauts de ligne

Séparez les paragraphes par une ligne vide. Pour un saut de ligne dans le même paragraphe, terminez la ligne par deux espaces avant d’appuyer sur Entrée

Markdown
This is paragraph one.

This is paragraph two.

Line one with two spaces at end  
Line two (soft break)
Résultat
<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>

Mise en valeur

Entourez le texte d’astérisques ou de tirets bas pour le mettre en gras ou en italique

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

Listes

Listes numérotées, à puces et imbriquées

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

Ordered list:
1. First
2. Second
3. Third
Résultat
<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

Un accent grave pour le code dans le texte, trois pour un bloc de code

Markdown
Inline `code` in text.

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

Tableaux

Des barres verticales et des tirets forment un tableau ; l’alignement des colonnes est réglable

Markdown
| Header 1 | Header 2 | Header 3 |
|----------|:--------:|---------:|
| Left     | Center   | Right    |
| Cell     | Cell     | Cell     |
Résultat
<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>

Citations

Le symbole > crée une citation ; les citations peuvent être imbriquées

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

Lignes horizontales

Trois tirets, astérisques ou tirets bas (ou plus) tracent une ligne de séparation

Markdown
---
***
___
Résultat
<hr>

Caractères d’échappement

Une barre oblique inverse devant un symbole spécial l’affiche comme du texte normal

Markdown
\*Not italic\*
\# Not a heading
\[Not a link\]
Résultat
*Not italic*
# Not a heading
[Not a link]