# Book directives

A chapter is Markdown; four directives and the footnotes give it what a book needs. Their numbers
and labels are computed by the book, the same in the web edition, the EPUB and the PDF.

## `::figure`

```md
::figure[The Lorem valley, seen from the ridge.]{src=./images/map.svg id=fig-map alt="Three rounded hills" width=75%}
```

A numbered figure: `Figure 2.3` is the third figure of chapter 2 (`1`, `2`… in an unnumbered
chapter). The label is the caption; a container (`:::figure{…}` … `:::`) takes a longer one.

| Attribute | Meaning                                                       |
| --------- | ------------------------------------------------------------- |
| `src`     | The image, relative to the chapter; it must exist             |
| `id`      | The id a `:ref` cites                                         |
| `alt`     | The text alternative, required                                |
| `width`   | A print length (`8cm`) or a percentage of the measure (`50%`) |

## `:ref`

```md
As the map shows (:ref[fig-map]), the valley of :ref[lorem] ends at :ref[lorem-night].
```

A cross-reference to a chapter, a section, a figure or a note, anywhere in the book. It prints the
label of its target (`Chapter 1`, `Figure 1.1`) and links to it, on its own page in the web edition.
An unknown id is an error with its file, its line and the closest id:
`✖ 02-ipsum.md:14 — :ref: unknown id "fig-mapp" (did you mean "fig-map"?)`. `show=page` and
`show=both` print the page number in the PDF.

## `:index`

```md
Consectetur :index[adipiscing]{sub="elit"} sed do. An :index[ipsum]{see="ipsum cycle"} is small.
```

The term stays in the text; the occurrence joins the index, a page A–Z when `back` lists `index`,
sorted in the language of the book. `sub` files it under a sub-entry, `see` adds a cross-reference.

## `:::epigraph`

```md
:::epigraph{source="Dolor"}
Sed ut perspiciatis unde omnis iste natus error.
:::
```

A quotation at the head of a chapter, its source under it.

## `:::dialogue`

```md
:::dialogue{cast=lorem}
Sed ut perspiciatis unde omnis.
:::
```

A line of a character of the book's bible (`cast:` in the entry), set as a paragraph of dialogue in
the language of the page: « Lorem. — Sed ut… » in French, the speaker's name in small caps as a play
sets it; « Lorem: “Sed ut…” » elsewhere. The name comes from the bible, in the page's language; a
book with no bible shows the id. Each paragraph of the line is one paragraph of dialogue.

## Notes

```md
Lorem ipsum dolor sit amet[^1].

[^1]: Duis aute irure dolor in reprehenderit.
```

GitHub footnotes. They are numbered per chapter, or through the whole book with
`noteNumbering: book`. On the web each chapter ends with its notes, each with a link back to its
call; in the EPUB and the PDF they go to the `notes` page when `back` lists it.

## Formulas, code and tables

A chapter takes what any Récit story takes: fenced code with its highlighting, GitHub tables and
KaTeX formulas (`$x^2$`, `$$…$$`). The EPUB declares MathML on the pages that hold a formula.
