# Markdown syntax

Each example shows the source, then what charon renders from it. Charon reads
CommonMark and GFM, plus the extensions below.

## Text

```md
**Bold**, *italic*, ***both*** and ~~struck~~.

==Marked==, ++inserted++, H~2~O and x^2^.

Use `inline code` for names and commands.
```

End a line with two spaces or a backslash to break it inside a paragraph. Put a
`\` before a character to show it as is: `\*not italic\*`.

## Headings

```md
## Section
### Subsection
#### Detail
```

Every heading gets an id from its text, so `## Set up` gets `set-up`. Two
headings with one text get `set-up` and `set-up-1`. Set your own with
`{#id}`: `## Plans {#plans}`.

## Lists

```md
- Oars
- Coins
  - Silver

1. Board
2. Cross
3. Land

- [x] Pay the fare
- [ ] Look back
```

## Quotes and rules

```md
> The river is wide.

---

Three dashes draw a rule.
```

## Callouts

```md
> [!NOTE]
> The ferry leaves at dusk.

> [!WARNING] Exact fare
> The ferryman gives no change.

> [!TIP]- Click to open
> Bring a coin for the way back.
```

Start a quote with a type in brackets. Text after it becomes the title; without
it, the type does. Put `-` after the type to fold the callout shut, or `+` to
fold it but start open.

The type sets the color:

| Color  | Types                                                        |
| ------ | ------------------------------------------------------------ |
| Blue   | `note`, `info`, `todo`, `abstract`, `summary`, `tldr`        |
| Green  | `tip`, `hint`, `success`, `check`, `done`                    |
| Purple | `important`, `example`                                       |
| Amber  | `warning`, `caution`, `attention`, `question`, `help`, `faq` |
| Red    | `danger`, `error`, `failure`, `fail`, `missing`, `bug`       |
| Gray   | `quote`, `cite`                                              |

Any other type shows in blue. Case does not matter.

## Links and images

```md
[Charon](https://charon.memomori.app) or just https://charon.memomori.app

![A boat](/assets/boat.svg){width=160}
```

Bare URLs become links. `{width=…}` sets an image's width. An image link to a
YouTube video becomes an embedded player.

## Tables

```md
| Coin   | Weight | Value |
| :----- | -----: | :---: |
| Obol   |  0.7 g |   1   |
| Drachm |  4.3 g |   6   |
```

Colons in the second row align a column left, right or center.

## Footnotes

```md
The fare was one obol.[^1]

[^1]: A small silver coin.
```

## Definitions and abbreviations

```md
Styx
: The river between the worlds.

Charon reads HTML too.

*[HTML]: HyperText Markup Language
```

## Emoji

```md
:boat: :coin: :white_check_mark:
```

## Attributes

```md
A paragraph with a class. {.lead}

[A link](https://example.com){target=_blank rel=noopener}
```

`{.class}`, `{#id}` and `{key=value}` set attributes on the element before
them.

## Math

```md
Inline: $E = mc^2$

$$
\int_0^1 x^2\,dx = \frac{1}{3}
$$
```

KaTeX draws the math. Pages with math need KaTeX's stylesheet; a docs site adds
it for you.

## HTML

```md
<details>
  <summary>Spoiler</summary>
  The ferryman never rows back empty.
</details>
```

Raw HTML passes through as written. Sanitize the output if the source comes
from users.

## Comments

```md
The river is cold. %%Check this before launch.%%

%%
Nothing here shows.
%%
```

Text between `%%` marks stays in the source and out of the output, on one line
or across many.

Links between notes, embeds, tags and block ids have [a page of their own](notes.md).
Code blocks, tables from CSV and diagrams are on [Code blocks](code.md).
