WikiAdministration

Markdown guide

Markdown source
Back
# Markdown guide

Everything a page can have, in the Markdown it is written in. Open this page in the editor to see the source.

## Text

Paragraphs, *emphasis*, **strong emphasis**, ~~strikethrough~~, `inline code` and links, to the web (<https://commonmark.org>) or to other pages by their path from this one: [diagrams](markdown-guide/diagrams), or the [tour](tour) next to this page, or [[tour|the same, as a wiki link]].[^paths]

A line break in the text is a line break on the page, in quotations and boxes too: write a paragraph on one line, however long, and break a line where you mean a break. A line that ends with a backslash goes on in the next one, with a space between them: a long sentence can be broken in the text and stay one line on the page. A footnote's number shows its note when the pointer rests on it.

**Copy permanent link** among a page's buttons copies a link to the page as it is at that moment: it keeps showing that version after the page is edited, and keeps working after the page is moved. The page it opens says which version it is, and links to the page as it is now. Its address is `/l/`, the page's id and the version, `/l/4f1c9a2e/?version=…`; written without the version, it leads to the page as it is now, wherever it is. The wiki's front page has no versions to link to, and no such button.

A page with three headings or more has a **Contents** panel beside it, listing them. `[[!toc]]` on a line of its own puts the list in the page instead. Without the exclamation mark, `[[toc]]` is a wiki link to a page named `toc`, like any other:

```markdown
An introduction.

[[!toc]]

## The first section
```

### Lists

- Bullets
  - nested
- and numbers:

1. one
2. two

### Tasks

- [x] Write the page
- [ ] Read it

A done task is struck through. Whoever may edit a page ticks its tasks in the page itself, without the editor. A tick is not saved at once, since every save keeps a whole copy of the page: a bar at the bottom counts the boxes changed, with "Save", which saves them all as one version, and "Discard". Leaving the page with ticks not saved asks first. Ticking a task ticks the tasks under it, ticking the last of them ticks it too, and unticking one unticks the tasks above it.

`{.sorted}` on the line before a list of tasks shows the done ones last, in the page only: the text keeps its order. An item without a box ends the list.

{.sorted}
- [x] Book the room
- [ ] Send the invitations
- [ ] Order the cake

`{.day}` on the line before a list makes it a day's list, as the template "Day" does. An item that starts with a time is an entry at that time, an item without one an entry for the whole day, and `!` at the start of an item highlights it. The page shows the items under "All day" and the parts of the day, by their times; the text keeps its order. On a day's page, a page whose title is a date, a task not ticked is missed from its hour on, or once its day is over, and is shown in red until it is ticked.

{.day}
- 09:00 Standup
- 9:30-10:30 Review of the plan
- ! 14:00 Demo for the client
- [ ] 16:00 Call the bank
- Buy milk

A calendar is a kind of page that **New page** offers while the plugin "Calendar" is on. Its days are the pages directly under it whose title is a date, such as `2026-11-27`. Its page shows its text, then a month, which opens on today's: the number of each day that has a page is a link to it, and the arrows page to the months before and after. Under the month, **All days** lists every day, newest first. Add a day with **New subpage** on the calendar, the date as its title, from the template "Day".

### Tables

| Feature  | Syntax              | Shown as         |
| -------- | ------------------- | ---------------: |
| Math     | `$…$`, `$$…$$`      | KaTeX            |
| Diagrams | a `mermaid` fence   | Mermaid          |
| Pictures | a `tikz` fence      | TikZ, by TikZJax |
| Code     | a fence with a name | highlight.js     |

> A quotation, for good measure.

### Emoji

A name between colons is an emoji. Pointing at one shows its name.

| You write            | You get            |
| -------------------- | ------------------ |
| `:tada:`             | :tada:             |
| `:rocket:`           | :rocket:           |
| `:white_check_mark:` | :white_check_mark: |
| `:+1:`               | :+1:               |

In the editor, a colon at the start of a word opens a list of emoji. Type a few letters of the name to narrow it: `:roc` offers :rocket:. Tab or a click writes the one chosen as its name between colons, and so does Enter once two letters are typed; before that, Enter is a new line. Escape closes the list and puts a backslash before the colon, `\:`, so that the colon stays a colon. The toolbar's "Emoji" button, the smiling face, opens a field to search the same names and writes the one you click at the cursor.

An item of a bulleted list that starts with an emoji shows the emoji in place of its bullet:

```markdown
- :white_check_mark: Written
- :construction: Being reviewed
- Not started
```

- :white_check_mark: Written
- :construction: Being reviewed
- Not started

In the editor, `-:` at the start of a line opens the same list and writes such an item: `-:tada` and Tab give `- :tada: `. A task keeps its box (`- [ ] :tada:`), a numbered list its numbers, and `- \:tada:` its bullet. The PDF and Word exports keep the bullet before the emoji.

The names are GitHub's, from its list [gemoji](https://github.com/github/gemoji/blob/master/db/emoji.json). A name from elsewhere, such as Slack, works only if GitHub's list has it: 🤔 is `:thinking:`, not `:thinking_face:`. A name that is not in the list stays text, as written. The newest emoji have no name in the list yet: paste them as they are.

A name in the list is an emoji wherever it is, even between digits: `1:100:2` is 1:100:2. To keep it text, put a backslash before its first colon: `1\:100:2` is 1\:100:2, and `\:tada:` is \:tada:. In inline code and in code blocks, colons are always text: `` `:tada:` `` is `:tada:`.

## Code

```haskell
main :: IO ()
main = putStrLn "Hello, world"
```

```javascript
const answer = [6, 7].reduce((a, b) => a * b);
```

Each block has a Copy button in its top right corner, shown when the pointer is over the block or the button has the keyboard's focus: it copies the code to the clipboard as written, and says Copied.

A long listing can show a few lines at a time: with `{rows=3}` after the fence's language, this one is three lines high, and the rest scrolls inside it.

```haskell {rows=3}
-- Scroll this block for the rest.
fibs :: [Integer]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)

main :: IO ()
main = print (take 20 fibs)
```

With `{.numbered}` after the language, each line has its number before it, in a margin that is not part of the code: neither selected nor copied with it. It goes with `rows` too, as `{.numbered rows=3}`.

```haskell {.numbered}
quicksort :: Ord a => [a] -> [a]
quicksort [] = []
quicksort (p : xs) =
  quicksort [x | x <- xs, x < p] ++ [p] ++ quicksort [x | x <- xs, x >= p]
```

## Mathematics

Inline, $a^2 + b^2 = c^2$, and on a line of its own:

$$\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}$$

Chemistry with `\ce`: $\ce{2 H2 + O2 -> 2 H2O}$. Macros, built in, of the space or of the page, are on [Mathematics](markdown-guide/mathematics).

## Diagrams

```mermaid
flowchart TD
  Markdown --> Parser[commonmark]
  Parser --> Halogen[Halogen HTML]
  Halogen --> Page
```

## Pictures

A `tikz` fence is drawn by TikZ, where you say where everything goes:

```tikz
\draw[->] (-0.5,0) -- (3.5,0) node[right] {$x$};
\draw[->] (0,-0.5) -- (0,2.5) node[above] {$y$};
\draw[thick, blue] (0,0.5) .. controls (1,2.5) and (2,-0.5) .. (3,1.5);
\fill (1.5,1) circle (2pt) node[above right] {a point};
```

## HTML with its own styles

An `html` fence is HTML styled as you like: `style` attributes and `<style>` elements work in it, and so do the wiki's own classes, such as the colours `c-red` and `h-yellow`. The page shows it in a frame of its own, so that its styles reach nothing outside it. Scripts, event handlers, forms and frames are left out, as anywhere in a page, and a link in it opens in a new tab.

```html
<style>
  .card { border: 2px solid; border-radius: 8px; padding: 0 1em; }
</style>
<div class="card">
  <p>A card styled by its own CSS, with the wiki's
  <span class="c-red">red</span> and <mark class="h-yellow">yellow</mark>.</p>
</div>
```

The frame is as high as what it holds; `{height=200}` after `html` makes it 200 pixels high instead, scrolling what is taller.

A fence the wiki draws, `html`, `latex`, `math`, `mermaid` or `tikz`, shows its source instead with `{.norender}` after its language:

```html {.norender}
<p style="color: teal">Shown as code, highlighted.</p>
```

## Notes and boxes

A quotation whose first line is a kind in brackets is a box. GitHub's five kinds each have a look of their own:

> [!NOTE]
> `> [!NOTE]`: something to know, even when skimming.

> [!TIP]
> `> [!TIP]`: a better way to do something.

> [!IMPORTANT]
> `> [!IMPORTANT]`: something needed to succeed.

> [!WARNING]
> `> [!WARNING]`: something that needs attention at once.

> [!CAUTION]
> `> [!CAUTION]`: what could go wrong if done.

Any other word makes a box too, titled with the word: `> [!EXERCISE]` below. An administrator can give a kind a title, a colour (one of the theme's, or any other from a colour picker) and an icon, under **Boxes** in the administration's **Editor** section; the demo defines `exercise` this way. A kind nobody defined is a plain box. The editor's **Box** button lists the kinds and writes the first line for you.

> [!EXERCISE]
> Write a box of your own kind, such as `> [!FUN-FACT]`.

Boxes are numbered, each kind on its own: the boxes above are Note 1, Tip 1 and so on, and this page's exercises Exercise 1 and Exercise 2. A space's settings choose how: within the page, after the page's number (`2.3`, the page being the second under its parent), after the page's and the section's (`2.1.3`, a section starting at each `##` heading), or no numbers at all. A star after the kind makes a box without a number:

> [!NOTE*]
> `> [!NOTE*]` is not counted, as LaTeX's `equation*`.

Text after the kind, on the same line, is that box's title, for any kind, after its number. It is read as text, so it can hold math:

> [!EXERCISE] The area of a circle, $\pi r^2$
> `> [!EXERCISE] The area of a circle, $\pi r^2$` titles this box.

## Blocks of the wiki's own

The wiki's own blocks are written between two lines of their own: a start marker, `[[!name]]`, and an end marker, `[[/name]]`, with any Markdown between them. The exclamation mark keeps a marker apart from a link to a page. Braces after the name hold attributes, as after a code fence: `#id`, `.class` and `key=value`. A box styled by its classes is a `div`:

[[!div]]{.summary}
Written `[[!div]]{.summary}`, this text, then `[[/div]]`.
[[/div]]

The names are `spoiler` (below), `notes` and `incremental` (on [Presentations](markdown-guide/presentations)) and `div`; `style`, `pause` and `toc` are one line each, with no end marker. Blocks nest, and an end marker ends the innermost open block when it has its name. A marker that is wrong, a name the wiki does not have, or a block never closed shows in red, with the reason, on the page and in the editor's preview.

## Spoilers

Two bars on each side hide a few words until they are clicked: the culprit is ||the butler||. A second click hides them again, and Enter or Space does the same. The toolbar's **Inline spoiler** button, an eye struck through, writes the bars around the words selected.

A block spoiler hides whole blocks behind a line the reader clicks. It starts with `[[!spoiler]]{name}(Description)` on a line of its own, and ends with `[[/spoiler]]`. The name is one word of letters, digits, `-` and `_` (`{#name}` is the same name); the description, which may hold Markdown, is what the reader sees and clicks. Anything goes between the two, code, lists and other spoilers among it, without a `>` on its lines. An end marker ends the innermost open spoiler; one that repeats the name, `[[/spoiler]]{answer}`, only the spoiler of that name. Spoilers nest:

[[!spoiler]]{hint}(A hint, if you are *stuck*)
Think of what six times seven is.

[[!spoiler]]{answer}(The answer)
Forty-two, as this program prints:

```python
print(6 * 7)
```
[[/spoiler]]{answer}
[[/spoiler]]{hint}

The toolbar's **Block spoiler** button writes the two markers around the lines selected, with `name` selected to type over.

What is wrong shows in red where it is, on the page and in the editor's preview as you type: a start marker without its name in braces or its description in parentheses, an end marker that does not name the innermost open spoiler, and the start marker of a spoiler that is never closed, with the reason under each. A spoiler that is not closed shows its blocks in red below its marker, as they are, so nothing is lost while you fix it. In this, the first line has no description, and the last names no open spoiler, so the second spoiler is never closed:

```markdown
[[!spoiler]]{answer}
[[!spoiler]]{answer}(The answer)
Forty-two.
[[/spoiler]]{anwser}
```

A spoiler starts closed, and your browser remembers the ones you left open, on each page, for you (and for whoever is not signed in, as one reader); it opens them again when you come back. Two spoilers with one name on a page open and close together. Another browser, or another device, starts with them closed.

A heading can hide its own section, with no end marker: start its text with `[[!spoiler]]` and a space, as in `### [[!spoiler]] Why?`. The heading shows, and a click on it opens what follows, up to the next heading of the same or a higher level, or the end of the quotation or box the heading is in. A name in braces right after the marker, `### [[!spoiler]]{why} Why?`, is what your browser remembers it by; without one, the heading's anchor is. A deeper heading spoiler in the section hides its own part of it. `[[!spoiler]]` anywhere else in a heading is a link that leads nowhere. The questions at the end of this section are heading spoilers.

A spoiler lies within one section, or wraps a whole one: its heading first, and everything up to the next heading of the same or a higher level. A spoiler that cuts a section shows in red, as one never closed does. The section stays in the page's contents, and following its entry, or any link to its heading, opens the spoiler; it is remembered like any other. The answers below are one:

[[!spoiler]]{exercise-answers}(The answers to this page's exercises)
### Answers

The sum of two even numbers is even: $2a + 2b = 2(a + b)$.
[[/spoiler]]

### [[!spoiler]] Does a heading spoiler need an end marker?

No: its section ends where the next heading of its level, or a higher one, starts.

### [[!spoiler]]{faq-nesting} Can heading spoilers nest?

Yes. The question below is a spoiler inside this one.

#### [[!spoiler]] How deep can they go?

As deep as headings go, down to `######`.

## Comments

A comment is text in the page's source that the page does not show: `<!--`, the text, then `-->`. It can sit among a paragraph's text, <!-- like this, --> on a line of its own, or span several lines:

```markdown
<!-- A note for whoever edits this next. -->

<!--
## A section not ready yet

Its text, kept out of the page, the contents and the search.
-->
```

Nothing between `<!--` and `-->` is read as Markdown, so a comment around blocks keeps them out of the page, headings and all, and out of its exports. A comment is hidden from the page, not from its readers: anyone who may read the page may open **View source** and read it there.

## Images, video and attachments

An image from the web:

![The Earth seen from Apollo 17 (NASA, public domain)](https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/The_Earth_seen_from_Apollo_17.jpg/960px-The_Earth_seen_from_Apollo_17.jpg)

A video from the web, written as an image whose address is a video:

![Sarychev Peak erupting, seen from the International Space Station (NASA, public domain)](https://upload.wikimedia.org/wikipedia/commons/transcoded/8/82/Sarychev_Peak_eruption_on_12_June_2009%2C_oblique_satellite_view.ogv/Sarychev_Peak_eruption_on_12_June_2009%2C_oblique_satellite_view.ogv.480p.vp9.webm)

And a file attached to this page, by its name:

![A tree](attachment:tree.png)

An SVG file is shown as an image too, and nothing in it runs. One that needs its scripts, such as a flame graph that zooms when you click it, is shown in a frame of its own with `{.interactive}`:

```
![Where the time goes](attachment:flame.svg){.interactive}
```

Its scripts run there cut off from the wiki: they cannot read your session or anything of the page, and cannot fetch anything from the wiki or elsewhere. The frame is 500 pixels high, or what `{.interactive height=700}` says, and you can drag its corner. The link under it downloads the file. It needs the wiki's server, which sends the file with the rules that keep its scripts in, and a secure address (HTTPS, or localhost): elsewhere, and in the demo, it is the image.

A presentation embedded with `{.presentation}` is shown one slide at a time, with buttons and the arrow keys to go through it and **Present** to show it full screen. Without the class, or for a page that is not a presentation, it is a link:

```
![Presentations](markdown-guide/presentations){.presentation}
```

![Presentations](markdown-guide/presentations){.presentation}

[^paths]: A path without a leading slash is read from this page's own address, as a browser reads a relative link.

What a page can hold