WikiAdministration

Markdown guide

History

Version 1 (current)

Saved by someone unknown

Read this version

The first version: all of its text is new.

1# Markdown guide
2
3Everything a page can have, in the Markdown it is written in. Open this page in the editor to see the source.
4
5## Text
6
7Paragraphs, *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]
8
9A 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.
10
11**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.
12
13A 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:
14
15```markdown
16An introduction.
17
18[[!toc]]
19
20## The first section
21```
22
23### Lists
24
25- Bullets
26 - nested
27- and numbers:
28
291. one
302. two
31
32### Tasks
33
34- [x] Write the page
35- [ ] Read it
36
37A 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.
38
39`{.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.
40
41{.sorted}
42- [x] Book the room
43- [ ] Send the invitations
44- [ ] Order the cake
45
46`{.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.
47
48{.day}
49- 09:00 Standup
50- 9:30-10:30 Review of the plan
51- ! 14:00 Demo for the client
52- [ ] 16:00 Call the bank
53- Buy milk
54
55A 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".
56
57### Tables
58
59| Feature | Syntax | Shown as |
60| -------- | ------------------- | ---------------: |
61| Math | `$…$`, `$$…$$` | KaTeX |
62| Diagrams | a `mermaid` fence | Mermaid |
63| Pictures | a `tikz` fence | TikZ, by TikZJax |
64| Code | a fence with a name | highlight.js |
65
66> A quotation, for good measure.
67
68### Emoji
69
70A name between colons is an emoji. Pointing at one shows its name.
71
72| You write | You get |
73| -------------------- | ------------------ |
74| `:tada:` | :tada: |
75| `:rocket:` | :rocket: |
76| `:white_check_mark:` | :white_check_mark: |
77| `:+1:` | :+1: |
78
79In 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.
80
81An item of a bulleted list that starts with an emoji shows the emoji in place of its bullet:
82
83```markdown
84- :white_check_mark: Written
85- :construction: Being reviewed
86- Not started
87```
88
89- :white_check_mark: Written
90- :construction: Being reviewed
91- Not started
92
93In 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.
94
95The 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.
96
97A 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:`.
98
99## Code
100
101```haskell
102main :: IO ()
103main = putStrLn "Hello, world"
104```
105
106```javascript
107const answer = [6, 7].reduce((a, b) => a * b);
108```
109
110Each 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.
111
112A 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.
113
114```haskell {rows=3}
115-- Scroll this block for the rest.
116fibs :: [Integer]
117fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
118
119main :: IO ()
120main = print (take 20 fibs)
121```
122
123With `{.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}`.
124
125```haskell {.numbered}
126quicksort :: Ord a => [a] -> [a]
127quicksort [] = []
128quicksort (p : xs) =
129 quicksort [x | x <- xs, x < p] ++ [p] ++ quicksort [x | x <- xs, x >= p]
130```
131
132## Mathematics
133
134Inline, $a^2 + b^2 = c^2$, and on a line of its own:
135
136$$\int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi}$$
137
138Chemistry with `\ce`: $\ce{2 H2 + O2 -> 2 H2O}$. Macros, built in, of the space or of the page, are on [Mathematics](markdown-guide/mathematics).
139
140## Diagrams
141
142```mermaid
143flowchart TD
144 Markdown --> Parser[commonmark]
145 Parser --> Halogen[Halogen HTML]
146 Halogen --> Page
147```
148
149## Pictures
150
151A `tikz` fence is drawn by TikZ, where you say where everything goes:
152
153```tikz
154\draw[->] (-0.5,0) -- (3.5,0) node[right] {$x$};
155\draw[->] (0,-0.5) -- (0,2.5) node[above] {$y$};
156\draw[thick, blue] (0,0.5) .. controls (1,2.5) and (2,-0.5) .. (3,1.5);
157\fill (1.5,1) circle (2pt) node[above right] {a point};
158```
159
160## HTML with its own styles
161
162An `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.
163
164```html
165<style>
166 .card { border: 2px solid; border-radius: 8px; padding: 0 1em; }
167</style>
168<div class="card">
169 <p>A card styled by its own CSS, with the wiki's
170 <span class="c-red">red</span> and <mark class="h-yellow">yellow</mark>.</p>
171</div>
172```
173
174The frame is as high as what it holds; `{height=200}` after `html` makes it 200 pixels high instead, scrolling what is taller.
175
176A fence the wiki draws, `html`, `latex`, `math`, `mermaid` or `tikz`, shows its source instead with `{.norender}` after its language:
177
178```html {.norender}
179<p style="color: teal">Shown as code, highlighted.</p>
180```
181
182## Notes and boxes
183
184A quotation whose first line is a kind in brackets is a box. GitHub's five kinds each have a look of their own:
185
186> [!NOTE]
187> `> [!NOTE]`: something to know, even when skimming.
188
189> [!TIP]
190> `> [!TIP]`: a better way to do something.
191
192> [!IMPORTANT]
193> `> [!IMPORTANT]`: something needed to succeed.
194
195> [!WARNING]
196> `> [!WARNING]`: something that needs attention at once.
197
198> [!CAUTION]
199> `> [!CAUTION]`: what could go wrong if done.
200
201Any 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.
202
203> [!EXERCISE]
204> Write a box of your own kind, such as `> [!FUN-FACT]`.
205
206Boxes 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:
207
208> [!NOTE*]
209> `> [!NOTE*]` is not counted, as LaTeX's `equation*`.
210
211Text 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:
212
213> [!EXERCISE] The area of a circle, $\pi r^2$
214> `> [!EXERCISE] The area of a circle, $\pi r^2$` titles this box.
215
216## Blocks of the wiki's own
217
218The 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`:
219
220[[!div]]{.summary}
221Written `[[!div]]{.summary}`, this text, then `[[/div]]`.
222[[/div]]
223
224The 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.
225
226## Spoilers
227
228Two 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.
229
230A 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:
231
232[[!spoiler]]{hint}(A hint, if you are *stuck*)
233Think of what six times seven is.
234
235[[!spoiler]]{answer}(The answer)
236Forty-two, as this program prints:
237
238```python
239print(6 * 7)
240```
241[[/spoiler]]{answer}
242[[/spoiler]]{hint}
243
244The toolbar's **Block spoiler** button writes the two markers around the lines selected, with `name` selected to type over.
245
246What 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:
247
248```markdown
249[[!spoiler]]{answer}
250[[!spoiler]]{answer}(The answer)
251Forty-two.
252[[/spoiler]]{anwser}
253```
254
255A 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.
256
257A 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.
258
259A 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:
260
261[[!spoiler]]{exercise-answers}(The answers to this page's exercises)
262### Answers
263
264The sum of two even numbers is even: $2a + 2b = 2(a + b)$.
265[[/spoiler]]
266
267### [[!spoiler]] Does a heading spoiler need an end marker?
268
269No: its section ends where the next heading of its level, or a higher one, starts.
270
271### [[!spoiler]]{faq-nesting} Can heading spoilers nest?
272
273Yes. The question below is a spoiler inside this one.
274
275#### [[!spoiler]] How deep can they go?
276
277As deep as headings go, down to `######`.
278
279## Comments
280
281A 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:
282
283```markdown
284<!-- A note for whoever edits this next. -->
285
286<!--
287## A section not ready yet
288
289Its text, kept out of the page, the contents and the search.
290-->
291```
292
293Nothing 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.
294
295## Images, video and attachments
296
297An image from the web:
298
299![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)
300
301A video from the web, written as an image whose address is a video:
302
303![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)
304
305And a file attached to this page, by its name:
306
307![A tree](attachment:tree.png)
308
309An 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}`:
310
311```
312![Where the time goes](attachment:flame.svg){.interactive}
313```
314
315Its 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.
316
317A 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:
318
319```
320![Presentations](markdown-guide/presentations){.presentation}
321```
322
323![Presentations](markdown-guide/presentations){.presentation}
324
325[^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