Référence de Markdown

by Philippe Proulx on 25 February 2025

Icitte sont montrés tous les features de ce thème accessibles à partir d'un article.

Prenez soin de regarder la source de cet article pour comprendre le lien avec le rendu, quoique j'essaie de montrer la source ici aussi.

Un article commence directement par un paragraphe. Le titre est donné par title dans le front matter, donc l'article ne doit pas contenir de titre de niveau un (# Meow).

Chaque article doit avoir une introduction qui se termine par une ligne contenant exactement ===. Essayez d'être pas trop fucked up dans l'introduction (quelques paragraphes, peut-être une image mince) parce que c'est ce qui se ramasse dans les boétes sur la page d'accueil et celles des auteurs.

Saveur de Markdown

Par défaut, c'est du GFM (qu'on me dit à l'oreillette).

On ajoute aussi Markdown Extra qui promet quelques trucs utiles, le plus intéressant étant selon moi de pouvoir inclure du Markdown dans du HTML :

<div class=large markdown=1>
...
</div>

Ça marche KOREK mais ce feature a des ratés. N'oubliez pas qu'en Markdown, quatre espaces en début de ligne indiquent un bloc litéral.

En général si vous rushez avec Markdown quelque part, utilisez plutôt HTML directement.

Un titre de niveau trois

Juste pour voir le monde. 🎶

Éléments en ligne

Éléments communs :

Accent
*Accent* ou _Accent_
Accent fort
**Accent fort** ou __Accent fort__
Accent combiné
**_Accent combiné_** ou __*Accent combiné*__
Barré
~~Barré~~
Code litéral
`Code litéral`
code litéral avec ` dedans
Je conseille <code>code litéral avec \` dedans</code>
Lien

[Lien](https://www.labatt.com/)

Vous pouvez faire des liens directement vers une page avec le chemin absolu, par exemple [eepp](/eepp) : eepp.

std::forward
[`std::forward`](https://en.cppreference.com/w/cpp/utility/forward)

Ligne horizontale

Comment :

***

Rendu :


Listes simples

Pour n'importe quoi d'un peu pimenté, genre du code dans une liste, passez directement par <ul> ou <ol> parce que ce parser Markdown semble un peu gay et ignore des espaces en début de ligne dans le code (à partir du niveau deux).

Comment :

* Lounge
  * Quest

  * Permission
    1. Wall
    1. Sport

  * Laborum occaecat anim sint nostrud elit ut
    non ut aliqua eu aliqua laboris laborum eiusmod nisi quis
    voluptate aliquip in voluptate nulla mollit esse ut.

  More text.

* Zoom

Rendu :

Liste de définitions

Ceci est une extension apportée par Markdown Extra.

Vous pouvez utiliser cette syntaxe pour les listes à un niveau, mais n'hésitez pas à prendre directement <dl> si vous avez un cas plus épicé.

Comment :

Lion
:   A large, muscular big cat known for its golden mane
    (in males) and powerful build. Lions are often
    called the "king of the jungle" due to their
    dominance in the animal kingdom and their social
    behavior, living in groups called prides.

Elephant
:   The largest land animal on Earth, known for its
    long trunk, large ears, and tusks.

    Elephants are intelligent, social animals that form tight
    family bonds and display strong emotional behavior.

Tiger
:   A powerful, solitary big cat recognized by its
    striking orange coat with black stripes. Tigers
    are apex predators, known for their
    stealth, strength, and ability to swim.

    <dl>
      <dt>Habitat
      <dd>
        Dense forests, mangrove swamps, and grasslands,
        primarily in Asia.

      <dt>Diet
      <dd>
        Carnivorous, hunting prey such as deer,
        wild boar, and water buffalo.
    </dl>

Rendu :

Lion
A large, muscular big cat known for its golden mane (in males) and powerful build. Lions are often called the "king of the jungle" due to their dominance in the animal kingdom and their social behavior, living in groups called prides.
Elephant

The largest land animal on Earth, known for its long trunk, large ears, and tusks.

Elephants are intelligent, social animals that form tight family bonds and display strong emotional behavior.

Tiger

A powerful, solitary big cat recognized by its striking orange coat with black stripes. Tigers are apex predators, known for their stealth, strength, and ability to swim.

Habitat
Dense forests, mangrove swamps, and grasslands, primarily in Asia.
Diet
Carnivorous, hunting prey such as deer, wild boar, and water buffalo.

Bloc cité

Comment :

> Discourage litigation. Persuade your neighbors to
> compromise whenever you can. As a peacemaker the lawyer
> has superior opportunity of being a good man.
>
> There will still be business enough:
>
> > A computer would deserve to be called intelligent if it could
> > deceive a human into believing that it was human.
> >
> > &mdash; Alan Turing
>
> Ouin ben t'as pas plus de GitHub vieux gay.
>
> &mdash; Abraham Lincoln

Rendu :

Discourage litigation. Persuade your neighbors to compromise whenever you can. As a peacemaker the lawyer has superior opportunity of being a good man.

There will still be business enough:

A computer would deserve to be called intelligent if it could deceive a human into believing that it was human.

— Alan Turing

Ouin ben t'as pas plus de GitHub vieux gay.

— Abraham Lincoln

Paragraph accentué

Comment :

<p class=epi>
Their muscular tail, large feet, and powerful legs
are designed for hopping and moving forward
efficiently, but these same
features make it <em>impossible</em> for
them to move backward.
</p>

Rendu :

Their muscular tail, large feet, and powerful legs are designed for hopping and moving forward efficiently, but these same features make it impossible for them to move backward.

Notes et avertissements

Commencez toujours par un paragraphe.

Comment :

<div class=tip markdown=1>
Always turn it upside down and shake it out
over the sink every now and then to clear out
crumbs.

This helps prevent burning smells and
reduces the risk of fire.
</div>

<div class=note markdown=1>
Sometimes, the smallest step in the right
direction ends up being the biggest step
of your life.

Keep going&mdash;you're closer than you think.
</div>

<div class=caution markdown=1>
Always wear:

- Hearing protection
- Safety goggles
- Dust mask

when using a leaf blower.

Flying debris can cause injury, and prolonged
exposure to noise can damage hearing.

Be mindful of others nearby and avoid
using it in dusty or windy conditions
</div>

Rendu :

Always turn it upside down and shake it out over the sink every now and then to clear out crumbs.

This helps prevent burning smells and reduces the risk of fire.

Sometimes, the smallest step in the right direction ends up being the biggest step of your life.

Keep going—you're closer than you think.

Always wear:

  • Hearing protection
  • Safety goggles
  • Dust mask

when using a leaf blower.

Flying debris can cause injury, and prolonged exposure to noise can damage hearing.

Be mindful of others nearby and avoid using it in dusty or windy conditions

Texte pur ou code

Comment :

```cpp
namespace bt2 {

using Error = bt2c::Error;
using OverflowError = bt2c::OverflowError;
using MemoryError = bt2c::MemoryError;
using TryAgain = bt2c::TryAgain;

/*
 * Unknown query object.
 */
class UnknownObject : public std::exception
{
public:
    explicit UnknownObject() noexcept = default;
};

} /* namespace bt2 */
```

Rendu :

namespace bt2 {

using Error = bt2c::Error;
using OverflowError = bt2c::OverflowError;
using MemoryError = bt2c::MemoryError;
using TryAgain = bt2c::TryAgain;

/*
 * Unknown query object.
 */
class UnknownObject : public std::exception
{
public:
    explicit UnknownObject() noexcept = default;
};

} /* namespace bt2 */

Utilisez le langage plain pour désactiver la coloration syntaxique.

Avec légende :

<div class=with-caption markdown=1>
<pre><code class=language-cpp>#include &lt;systemc.h&gt;

SC_MODULE(AndGate) {
    sc_in&lt;bool&gt; A, B;
    sc_out&lt;bool&gt; Y;

    void do_and() {
        Y.write(A.read() &amp;&amp; B.read());
    }

    SC_CTOR(AndGate) {
        SC_METHOD(do_and);
        sensitive &lt;&lt; A &lt;&lt; B;
    }
};</code></pre>

2-input _AND_ gate in
[SystemC](https://systemc.org/).
</div>
#include <systemc.h>

SC_MODULE(AndGate) {
    sc_in<bool> A, B;
    sc_out<bool> Y;

    void do_and() {
        Y.write(A.read() && B.read());
    }

    SC_CTOR(AndGate) {
        SC_METHOD(do_and);
        sensitive << A << B;
    }
};

2-input AND gate in SystemC.

Malheureusement, <, > et & semblent transformés en leur entité textuel en utilisant du Markdown dans <div markdown=1>, donc vous devez utiliser du HTML pur noisetier et donc convertir vous-même vos </>/&.

Si le texte est trop large, insérez le tout dans un contenant large :

<div class=large>
<pre><code class=language-cpp>namespace bt2c {
/*
 * Partial implementation of INVOKE.
 */
template &lt;typename FuncT, typename... ArgTs&gt;
auto call(FuncT func, ArgTs&amp;&amp;...args) -&gt; decltype(std::ref(func)(std::forward&lt;ArgTs&gt;(args)...))
{
    return std::ref(func)(std::forward&lt;ArgTs&gt;(args)...);
}

} /* namespace bt2c */</code></pre>
</div>

Rendu :

namespace bt2c {
/*
 * Partial implementation of INVOKE.
 */
template <typename FuncT, typename... ArgTs>
auto call(FuncT func, ArgTs&&...args) -> decltype(std::ref(func)(std::forward<ArgTs>(args)...))
{
    return std::ref(func)(std::forward<ArgTs>(args)...);
}

} /* namespace bt2c */

Contenu de fichier

Comment :

<div class=file>
  <pre>make-span.hpp</pre>
  <pre><code class=language-cpp>/*
 * Copyright (c) 2024 EfficiOS Inc.
 *
 * SPDX-License-Identifier: MIT
 */

#ifndef BABELTRACE_CPP_COMMON_BT2C_MAKE_SPAN_HPP
#define BABELTRACE_CPP_COMMON_BT2C_MAKE_SPAN_HPP

#include "cpp-common/bt2s/span.hpp"

namespace bt2c {

template &lt;class T&gt;
inline constexpr bt2s::span&lt;T&gt; makeSpan(T * const ptr,
                                        const size_t count) noexcept
{
    return nonstd::make_span(ptr, count);
}

template &lt;class T&gt;
inline constexpr bt2s::span&lt;T&gt; makeSpan(T *first, T *last) noexcept
{
    return nonstd::make_span(first, last);
}

} /* namespace bt2c */

#endif /* BABELTRACE_CPP_COMMON_BT2C_MAKE_SPAN_HPP */</code></pre>
</div>

Rendu :

make-span.hpp
/*
 * Copyright (c) 2024 EfficiOS Inc.
 *
 * SPDX-License-Identifier: MIT
 */

#ifndef BABELTRACE_CPP_COMMON_BT2C_MAKE_SPAN_HPP
#define BABELTRACE_CPP_COMMON_BT2C_MAKE_SPAN_HPP

#include "cpp-common/bt2s/span.hpp"

namespace bt2c {

template <class T>
inline constexpr bt2s::span<T> makeSpan(T * const ptr,
                                        const size_t count) noexcept
{
    return nonstd::make_span(ptr, count);
}

template <class T>
inline constexpr bt2s::span<T> makeSpan(T *first, T *last) noexcept
{
    return nonstd::make_span(first, last);
}

} /* namespace bt2c */

#endif /* BABELTRACE_CPP_COMMON_BT2C_MAKE_SPAN_HPP */

Si le texte est trop large, utilisez un contenant large :

<div class="large file">
<pre>vector.hpp</pre>
<pre><code class=language-cpp>/*
 * SPDX-FileCopyrightText: 2022 Simon Marchi <simon.marchi@efficios.com>
 *
 * SPDX-License-Identifier: MIT
 */

#ifndef BABELTRACE_CPP_COMMON_BT2C_VECTOR_HPP
#define BABELTRACE_CPP_COMMON_BT2C_VECTOR_HPP

#include &lt;vector&gt;

#include "common/assert.h"

namespace bt2c {

/*
 * Moves the last entry of `vec` to the index `idx`, then removes the last entry.
 *
 * Meant to be a direct replacement for g_ptr_array_remove_index_fast(), but for
 * `std::vector`.
 */
template &lt;typename T, typename AllocatorT&gt;
void vectorFastRemove(std::vector&lt;T, AllocatorT&gt;&amp; vec,
                      const typename std::vector&lt;T, AllocatorT&gt;::size_type idx)
{
    BT_ASSERT_DBG(idx &lt; vec.size());

    if (idx &lt; vec.size() - 1) {
        vec[idx] = std::move(vec.back());
    }

    vec.pop_back();
}

} /* namespace bt2c */

#endif /* BABELTRACE_CPP_COMMON_BT2C_VECTOR_HPP */</code></pre>
</div>
vector.hpp
/*
 * SPDX-FileCopyrightText: 2022 Simon Marchi 
 *
 * SPDX-License-Identifier: MIT
 */

#ifndef BABELTRACE_CPP_COMMON_BT2C_VECTOR_HPP
#define BABELTRACE_CPP_COMMON_BT2C_VECTOR_HPP

#include <vector>

#include "common/assert.h"

namespace bt2c {

/*
 * Moves the last entry of `vec` to the index `idx`, then removes the last entry.
 *
 * Meant to be a direct replacement for g_ptr_array_remove_index_fast(), but for
 * `std::vector`.
 */
template <typename T, typename AllocatorT>
void vectorFastRemove(std::vector<T, AllocatorT>& vec,
                      const typename std::vector<T, AllocatorT>::size_type idx)
{
    BT_ASSERT_DBG(idx < vec.size());

    if (idx < vec.size() - 1) {
        vec[idx] = std::move(vec.back());
    }

    vec.pop_back();
}

} /* namespace bt2c */

#endif /* BABELTRACE_CPP_COMMON_BT2C_VECTOR_HPP */

Avec légende :

<div class=with-caption markdown=1>
<div class=file markdown=1>
<pre>meow.py</pre>

```py
def _try_parse_rep_block(self):
    begin_text_loc = self._text_loc

    # Match prefix
    if self._try_parse_pat(self._rep_block_prefix_pat) is None:
        # No match
        return

    # Expect expression
    self._skip_ws_and_comments()
    expr_str, expr = self._expect_rep_mul_expr()

    # Parse items
    self._skip_ws_and_comments_and_syms()
    items = self._parse_items()

    # Expect end of block
    self._skip_ws_and_comments_and_syms()
    self._expect_pat(
        self._block_end_pat,
        "Expecting an item or `!end` (end of repetition block)"
    )

    # Return item
    return _Rep(items, expr_str, expr, begin_text_loc)
```
</div>

The famous `_try_parse_rep_block()` function.
</div>
meow.py
def _try_parse_rep_block(self):
    begin_text_loc = self._text_loc

    # Match prefix
    if self._try_parse_pat(self._rep_block_prefix_pat) is None:
        # No match
        return

    # Expect expression
    self._skip_ws_and_comments()
    expr_str, expr = self._expect_rep_mul_expr()

    # Parse items
    self._skip_ws_and_comments_and_syms()
    items = self._parse_items()

    # Expect end of block
    self._skip_ws_and_comments_and_syms()
    self._expect_pat(
        self._block_end_pat,
        "Expecting an item or `!end` (end of repetition block)"
    )

    # Return item
    return _Rep(items, expr_str, expr, begin_text_loc)

The famous _try_parse_rep_block() function.

Terminal

Comment :

<pre class=sh>
$ cd $(mktemp -d)
$ wget \
~ http://lttng.org/files/lttng-modules/lttng-modules-latest-2.13.tar.bz2
$ tar -xf lttng-modules-latest-2.13.tar.bz2
$ cd lttng-modules-2.13.*
$ make
$ sudo make modules_install
$ sudo depmod -a
</pre>

<div class=with-caption markdown=1>
<pre class=sh>
$ date
Sat 19 Apr 2025 09:12:04 PM EDT
</pre>

Obtain the current date and time.
</div>

<div class=large>
<pre class=sh>
$ some-command --meow=mix --bateau=23
Tenderloin leberkas jerky frankfurter.
Hamburger pork belly t-bone,
cupim burgdoggen

+ flank
- bacon

venison drumstick. Turducken sirloin
# git status
HEAD detached at review/master
Changes not staged for commit:
    modified:   src/plugins/ctf/common/metadata/ctf-ir.hpp

no changes added to commit
</pre>
</div>

Rendu :

$ cd $(mktemp -d)
$ wget \
~ http://lttng.org/files/lttng-modules/lttng-modules-latest-2.13.tar.bz2
$ tar -xf lttng-modules-latest-2.13.tar.bz2
$ cd lttng-modules-2.13.*
$ make
$ sudo make modules_install
$ sudo depmod -a
$ date
Sat 19 Apr 2025 09:12:04 PM EDT

Obtain the current date and time.

$ some-command --meow=mix --bateau=23
Tenderloin leberkas jerky frankfurter.
Hamburger pork belly t-bone,
cupim burgdoggen

+ flank
- bacon

venison drumstick. Turducken sirloin
# git status
HEAD detached at review/master
Changes not staged for commit:
    modified:   src/plugins/ctf/common/metadata/ctf-ir.hpp

no changes added to commit

Comme vous pouvez voir:

Tableau

Comment :

| Name | Birth date | Best known movie |
|---|---|---|
| Meryl Streep | June 22, 1949 | The Devil Wears Prada |
| Scarlett Johansson | November 22, 1984 | Avengers: Endgame |
| Jennifer Lawrence | August 15, 1990 | The Hunger Games |
| Julia Roberts | October 28, 1967 | Pretty Woman |
| Angelina Jolie | June 4, 1975 | Mr. & Mrs. Smith |
| Natalie Portman | June 9, 1981 | Black Swan |
| Emma Watson | April 15, 1990 | Harry Potter series |
| Sandra Bullock | July 26, 1964 | Gravity |
| Cate Blanchett | May 14, 1969 | Blue Jasmine |
| Margot Robbie | July 2, 1990 | Barbie |

Rendu :

Name Birth date Best known movie
Meryl Streep June 22, 1949 The Devil Wears Prada
Scarlett Johansson November 22, 1984 Avengers: Endgame
Jennifer Lawrence August 15, 1990 The Hunger Games
Julia Roberts October 28, 1967 Pretty Woman
Angelina Jolie June 4, 1975 Mr. & Mrs. Smith
Natalie Portman June 9, 1981 Black Swan
Emma Watson April 15, 1990 Harry Potter series
Sandra Bullock July 26, 1964 Gravity
Cate Blanchett May 14, 1969 Blue Jasmine
Margot Robbie July 2, 1990 Barbie

Avec légende :

<div class=with-caption markdown=1>
| Name | Birth date | Best known movie |
|---|---|---|
| Meryl Streep | June 22, 1949 | The Devil Wears Prada |
| Scarlett Johansson | November 22, 1984 | Avengers: Endgame |
| Jennifer Lawrence | August 15, 1990 | The Hunger Games |
| Julia Roberts | October 28, 1967 | Pretty Woman |
| Angelina Jolie | June 4, 1975 | Mr. & Mrs. Smith |
| Natalie Portman | June 9, 1981 | Black Swan |
| Emma Watson | April 15, 1990 | Harry Potter series |
| Sandra Bullock | July 26, 1964 | Gravity |
| Cate Blanchett | May 14, 1969 | Blue Jasmine |
| Margot Robbie | July 2, 1990 | Barbie |

Popular movies of famous actresses.
</div>
Name Birth date Best known movie
Meryl Streep June 22, 1949 The Devil Wears Prada
Scarlett Johansson November 22, 1984 Avengers: Endgame
Jennifer Lawrence August 15, 1990 The Hunger Games
Julia Roberts October 28, 1967 Pretty Woman
Angelina Jolie June 4, 1975 Mr. & Mrs. Smith
Natalie Portman June 9, 1981 Black Swan
Emma Watson April 15, 1990 Harry Potter series
Sandra Bullock July 26, 1964 Gravity
Cate Blanchett May 14, 1969 Blue Jasmine
Margot Robbie July 2, 1990 Barbie

Popular movies of famous actresses.

Pour un tableau plus corsé, utilisez <table> directement. Notez que vous pouvez toujours réactiver Markdown dans un élément avec markdown=1.

Insérez le tableau dans un contenant large s'il est trop large :

<div class=large markdown=1>
| Name | Birth date | Best known movie | Nationality | Awards won |
|---|---|---|---|---|
| Meryl Streep | June 22, 1949 | The Devil Wears Prada | American | 3 Oscars, 8 Golden Globes |
| Scarlett Johansson | November 22, 1984 | Avengers: Endgame | American | 1 BAFTA, 1 Tony Award |
| Jennifer Lawrence | August 15, 1990 | The Hunger Games | American | 1 Oscar, 3 Golden Globes |
| Julia Roberts | October 28, 1967 | Pretty Woman | American | 1 Oscar, 3 Golden Globes |
| Angelina Jolie | June 4, 1975 | Mr. & Mrs. Smith | American | 1 Oscar, 3 Golden Globes |
| Natalie Portman | June 9, 1981 | Black Swan | Israeli-American | 1 Oscar, 2 Golden Globes |
| Emma Watson | April 15, 1990 | Harry Potter series | British | 1 BAFTA, 1 MTV Award |
| Sandra Bullock | July 26, 1964 | Gravity | American | 1 Oscar, 1 Golden Globe |
| Cate Blanchett | May 14, 1969 | Blue Jasmine | Australian | 2 Oscars, 3 Golden Globes |
| Margot Robbie | July 2, 1990 | Barbie | Australian | 2 BAFTA Awards |
</div>

Rendu :

Name Birth date Best known movie Nationality Awards won
Meryl Streep June 22, 1949 The Devil Wears Prada American 3 Oscars, 8 Golden Globes
Scarlett Johansson November 22, 1984 Avengers: Endgame American 1 BAFTA, 1 Tony Award
Jennifer Lawrence August 15, 1990 The Hunger Games American 1 Oscar, 3 Golden Globes
Julia Roberts October 28, 1967 Pretty Woman American 1 Oscar, 3 Golden Globes
Angelina Jolie June 4, 1975 Mr. & Mrs. Smith American 1 Oscar, 3 Golden Globes
Natalie Portman June 9, 1981 Black Swan Israeli-American 1 Oscar, 2 Golden Globes
Emma Watson April 15, 1990 Harry Potter series British 1 BAFTA, 1 MTV Award
Sandra Bullock July 26, 1964 Gravity American 1 Oscar, 1 Golden Globe
Cate Blanchett May 14, 1969 Blue Jasmine Australian 2 Oscars, 3 Golden Globes
Margot Robbie July 2, 1990 Barbie Australian 2 BAFTA Awards

Image mince

Comment :

![](pexels-pripicart-547557.jpg)

Rendu :

Avec légende :

<div class=with-caption markdown=1>
![](pexels-pripicart-547557.jpg)

Une magnifique campagne.
</div>

Une magnifique campagne.

Image large

Comment :

<div class=large markdown=1>
![](alain-zouvi.jpeg)
</div>

<div class=with-caption markdown=1>
<div class=large markdown=1>
![](alain-zouvi.jpeg)
</div>

Alain Zouvi.
</div>

Rendu :

Alain Zouvi.

Image pleine largeur

Comment :

<div class=full markdown=1>
![](pexels-dennisleinarts-1120236.jpg)
</div>

Rendu :

That's it!