arsalan-anwari's picture
Sync templates from znote
16b79eb verified
|
Raw History Blame Contribute Delete
4.42 kB
# ZAL Analytics templates
Code-first technical writing: documentation, short engineering notes and 16:9 slides. Monochrome,
sharp corners, monospace headings and labels, with a rosewood accent used sparingly.
## Templates
- **Documentation** (`documentation`): longer technical documents. Parameters: `title` (default
`"Title"`), `summary` (`none`, a short line under the title), `author` (`none`), `version`
(`none`), `date` (today as `YYYY-MM-DD`). Prints author · version · date, the title and the
summary, then a table of contents (`outline(depth: 2)`). Header: title left, version · date
right. Footer: "page / total". Headings are numbered `1.1`.
- **Note** (`note`): short engineering notes. Parameters: `title` (`"Title"`), `topic`
(`"Note"`, a small label top left), `author` (`none`), `date` (today). Prints topic, author ·
date and the title over a black rule. Footer: page number. Headings are not numbered.
- **Slides** (`slides`): 16:9 presentations. Parameters: `title` (`"Title"`), `subtitle` (`none`),
`author` (`none`), `date` (today). The first slide is a dark dotted title slide made from these
parameters. Footer: title and slide number.
## Writing a page
The template already styles: page size and margins, font and size, monospace bold headings with
spacing, a thin rule under every `==` heading, `—` list markers, tables with thin grey borders and
a small upper-case monospace header row, code blocks in a light grey bordered box, inline code on
a grey background, and underlined links.
Documentation: use `=` for sections, `==` and `===` below; numbering is automatic. Only `=` and
`==` appear in the contents.
Note: write directly; use `==` (with its rule) for sections.
Slides:
- Each `= Heading` starts a new slide; the heading is the slide title (28pt).
- `== Heading` is a smaller subheading inside the current slide.
- Content after a `=` heading belongs to that slide until the next `=`. Text that does not fit
flows onto an extra page without a title, so keep slides short.
- Do not create a title slide; it is generated from the parameters.
````typ
= Build
== Steps
- Install the toolchain
- Run the build
```sh
cargo build --release
```
````
Code is the main content type: use fenced code blocks with a language tag (` ```rust `,
` ```sh `) and `` `inline code` ``. Use `#table(...)` for structured data; the first row becomes
the label-style header automatically.
## Helpers
`callout(title: "Note", body)`: a bordered box with a rosewood left bar and a small upper-case
title. Use for notes, warnings and tips.
```typ
#callout[The API is unstable before version 1.0.]
#callout(title: "Warning")[This command deletes the cache.]
```
`label(body)`: small grey upper-case monospace text with wide letter spacing, as in the header
and table headers. Use it for short labels or metadata.
```typ
#label[Status] Stable
```
Note: this `label` replaces Typst's built-in `label` function. To mark something for a reference,
use the `<name>` syntax (`= Install <install>` then `@install`), never `label("name")`. Heading
references need numbered headings, so they work in Documentation only.
`today`: today's date as a `YYYY-MM-DD` string.
Colours, only when something must be coloured: `ink` (body text), `coal` (dark title-slide
background), `quiet` (grey labels), `rule` (light grey lines), `rosewood` (the one accent; use
sparingly). `sans` and `mono` are the font lists; `dots` is the title-slide background pattern.
```typ
#text(fill: rosewood)[deprecated]
```
## Do not
- Do not add `#set page`, `#set text`, `#set par`, `#set list` or font changes; the template sets
them.
- Do not use your own colours (`rgb(...)`, `blue`, ...); the look is monochrome. Use `rosewood`
or `quiet` only when something must stand out.
- Do not build your own boxes with `block`, `rect` or `box`, and do not wrap code in boxes; use
`callout`, and plain code blocks (they are already boxed).
- Do not remove or edit the template header between `// znote:template` and `// znote:end`.
- Do not write the title, summary, author, version, date or a table of contents; the template
prints them.
- Do not call `note(...)` inside a page: it is the Note template's show rule, not a box. Use
`callout`.
- Do not use `label(...)` to create reference labels (see above), and do not number headings by
hand.
- In slides do not use `#pagebreak()` to start slides; use `=`.