@tolokoban/impress 0.13.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,7 +29,9 @@ In a terminal, the output is colored: file names in bold, the example of AI prom
29
29
  ## Slides
30
30
 
31
31
  - `#` headings become section slides (blue background).
32
- - Deeper headings become content slides, split over several slides when they are too long. A deeper heading with no content of its own, only sub-headings, gets a section slide too: its big title is still the `#` heading above it, and the deeper heading goes in the subtitle (e.g. `Possibilités`).
32
+ - Deeper headings become content slides, split over several slides when they are too long. A deeper heading with no content of its own, only sub-headings, gets a section slide too.
33
+ - A section slide shows the `#` heading as its title, at the top, and below it a box with the hierarchy of the sections under that `#` heading, as nested bullet points. A section is expanded (its sub-sections are listed) only if the slide after the section slide is inside it. The section the slide introduces is highlighted (bold, color `sectionHighlight`); on the slide of a `#` heading, it is the sub-section holding the next slide.
34
+ - When the slides go back up more than one heading level, a section slide recalls where we are before the next slides. From `1 > 1 > 1`, going to `1 > 2` or to `1 > 2 > 1` shows the section slide of `1 > 2`; going to `1 > 1 > 2` does not.
33
35
  - Paragraphs, lists, tables, blockquotes and images are laid out automatically: images go beside or below the text depending on their shape.
34
36
  - A table too long for one slide is first spread over two side-by-side tables on the same slide. If that is still too long, it is split over several slides. In both cases the header row is repeated on each part, and every part keeps the same column widths. Put `@compact` before the table to shrink it onto one slide instead (see [Pragmas](#pragmas)).
35
37
  - Table cells can hold images, as HTML (`<img src="logos/claude.webp" alt="Claude" width="48" height="48">`) or markdown (`![Claude](logos/claude.webp)`). Their pixel sizes assume a 16px font: a 48px image is 3 times as tall as the text of the table, and it shrinks with the text of a `@compact` table. With only `width` or `height`, the other one follows the shape of the image; with neither, the image is 2 lines tall. An image alone in its cell is centered, otherwise it comes before the text. Images too wide for their column are shrunk to fit.
@@ -37,6 +39,7 @@ In a terminal, the output is colored: file names in bold, the example of AI prom
37
39
  - Lists can be bulleted (`- item`, `* item`) or numbered (`1. item`, `1) item`), and the two can be nested in each other. A numbered list starts at the number of its first item (`4.` starts at 4); the number of each following item is computed, not read. Numbered items get numbers `1.`, then letters `a.` and roman numerals `i.` when nested (see [Numbers](#numbers)).
38
40
  - Blockquotes (`> ...`) are shown in a bordered box with a soft blurred shadow.
39
41
  - A code block whose language is `prompt` is shown as a chat bubble.
42
+ - A line of dashes (`----`, at least three) draws a horizontal rule across the content of the slide (style `Separateur`).
40
43
 
41
44
  ## Pragmas
42
45
 
@@ -53,10 +56,53 @@ At the start of a line in the `.md` file:
53
56
  | `@graph <file.dot>` | Insert a Graphviz diagram (path relative to the `.md`), rendered by `dot -Tpng` (the same Cairo renderer as DOT viewers, so the diagram looks the same in the slides) and embedded in the `.odp` as a WebP image. The fonts, sizes and colors of the theme are inserted as `graph [...]`, `node [...]` and `edge [...]` defaults at the start of the graph, so every attribute set in the `.dot` file wins, including its own `node [...]` / `edge [...]` defaults. |
54
57
  | `@next` | Start a new slide with the same title as the current one. If the next line is a heading (`#`, `##`…), that heading gives the new slide its title instead. |
55
58
  | `@compact` | The next table of the section, if it is too long for one slide, has its text shrunk (down to 4pt) until it fits on one slide with the paragraph introducing it, instead of being split into two columns or over several slides. The words of the header are never cut: if one of them is too long for its column, the text is shrunk further, even when the table would fit at full size (a header cell of several words may still wrap between words). |
59
+ | `@compact [N\|*] {` … `@}` | Compact everything in between on one slide, flowing through `N` columns (`@compact {`: one column). The content flows in reading order and the columns are balanced, so the tallest one is as short as possible. A list can be cut between its top-level items (a sub-item stays with its parent, numbering continues), and a table between its rows (its header is repeated at the top of each column). Paragraphs, quotes, code blocks and images are never cut. If there are fewer of these pieces than columns, fewer columns are used. The columns are separated by 1em, and an image takes the width of its column. If the region does not fit on the slide with the paragraph introducing it, everything in it (text, spacing, tables, images) is shrunk by the same factor, half a point of body text at a time, down to 10pt for a 24pt body text. Like a `@compact` table, the region stays on the current slide if it fits there, otherwise it starts a new one with its introduction. `@compact * {` tries 1, 2, 3… columns and keeps the number giving the biggest text, the fewest columns on a tie, avoiding those where a word would be too long for its column. `@note` and `@reveal` work inside a region. A heading, `@next` or `@layout` inside a region, a region inside another one, a region in a cell of an `@layout`, a region not closed by `@}` and an `@}` without a region are errors. |
56
60
  | `@reveal [C<columns>] [R<rows>]` | The rows of the next table appear one slide after the other: the first slide shows only the header, each following slide reveals one more row. The table keeps its final size and place from the first slide. `C` and `R` list the columns and the body rows (counted from 1, header excluded) that are always visible, as numbers and ranges: `@reveal C1,3 R1-4` always shows columns 1 and 3 and rows 1 to 4. Both are optional. The speaker notes are repeated on every slide of the sequence. A revealed table always stays on one slide, and its header words are never cut, as with `@compact`: if it is too long, its rows are first spread over two side-by-side tables, and if that is still too long, its text is shrunk, on one table or two side by side, whichever keeps the text bigger. A table inside an `@layout` is shown entirely. |
61
+ | `@anim [<index>] (<property>=<from>:<to>, …) [<duration> [<delay>]] [<easing>] {` … `@}` | Animate everything in between in the slideshow, on the same slide as the rest (see [Animations](#animations)). |
62
+ | `@animation [(<property>=<from>:<to>, …)] [<duration> [<delay>]] [<easing>]` | Defaults of the animations of the current slide: properties and timing (see [Animations](#animations)). |
63
+ | `@box <name> {` … `@}` | Draw the paragraphs, lists and boxes in between in a box, styled by the box `<name>` of the style file: background, text color, font, border, rounded corners, shadow, padding and margin (see [Boxes](#boxes)). Boxes can be nested: each `@}` closes the innermost open box. The box takes the width of the content (or of its column, in a `@compact {` region or an `@layout` cell) and the height of its content. It can be inside a `@compact {` or an `@anim {` region (it is animated as a whole, with its nested boxes), but cannot hold a `@compact {` or `@anim {` region, a heading, an image, a table, a quote or a code block. An unknown box name, a box not closed by `@}` and these blocks inside a box are errors. |
57
64
 
58
65
  When some files contain `@hint`, the end of the output gives a ready-to-paste prompt asking an AI agent to apply them to the `.odp`.
59
66
 
67
+ ### Animations
68
+
69
+ `@anim … {` … `@}` animates the blocks in between with real Impress animations, played by the slideshow, all on one slide:
70
+
71
+ ```md
72
+ @animation (300ms)
73
+
74
+ @anim 2 (opacity=0.1:1) {
75
+
76
+ - Foo
77
+ - Bar
78
+
79
+ @}
80
+
81
+ Hello world!
82
+
83
+ @anim 1 (opacity=0.1:1) {
84
+
85
+ ![Alt text](img/toto.png)
86
+
87
+ @}
88
+ ```
89
+
90
+ When the slide appears, the list and the image have an opacity of 0.1. The first click fades the image in (index 1) in 300ms, the second one fades the list in (index 2), and the next click goes to the next slide.
91
+
92
+ - **Properties**: `opacity=<from>:<to>` (from 0 to 1) and `scale=<from>:<to>` (`scale=0.5:1`, or `scale=0.5,1:1,1` for different horizontal and vertical scales, around the center of the shape). Several properties are separated by commas: `(opacity=0.1:1, scale=0.5:1)`. The shapes start with the `from` values as soon as the slide appears.
93
+ - **Index**: the integral part of the index is the number of clicks that plays the animation. The gaps do not matter, only the order: indexes 1 and 5 take two clicks. Index 0 (or no index) plays as soon as the slide appears, without a click. In a click, the decimals chain the animations: with indexes 1, 1.2 and 1.5, the click plays 1, then 1.2 once 1 has ended, then 1.5. Animations with the same index play together.
94
+ - **Timing**: as in the CSS `transition` shorthand, the first time (`300ms`, `0.3s`) is the duration and the second one is the delay before the start, and an easing (`linear`, `ease-in`, `ease-out`, `ease-in-out`) can come anywhere: `@anim 1 (opacity=0.1:1) 500ms 200ms ease-out {`. A property can have its own timing: `(opacity=0.1:1 300ms, scale=0.5:1 600ms 100ms)`. The next index of a click starts when the longest animation of the previous one ends, delay included.
95
+ - **`@animation`** gives the defaults of the `@anim` regions of the slide it is on (its section, including the slides it overflows onto), with the same syntax as `@anim` without the index: `@animation (opacity=0.2:0.8 500ms) 300ms ease-out`. The last one of the slide wins, wherever it is. `@animation (300ms)` is a short form for a timing alone. The `@anim` regions inherit what they do not give themselves:
96
+ - `@anim {` or `@anim 2 300ms {` (no parentheses) takes all the properties of `@animation`, with their values and timing.
97
+ - `@anim (opacity 900ms) {` (a property without values) takes the values of the same property of `@animation`.
98
+ - `@anim (scale=0.5:1) {` has its own list of properties: the other properties of `@animation` are not animated.
99
+ - For each of the duration, the delay and the easing, the first one given wins: on the property in `@anim`, on the `@anim`, on the property in `@animation`, on the `@animation`. Without any, animations last 500ms, with no delay and a linear easing. An `@anim` without properties, or a property without values, that `@animation` does not complete is an error.
100
+ - Each block in a region (paragraph, list, table, image, code…) is a shape of its own, and all of them animate together. A table carries the images of its cells along.
101
+ - A region can be inside a `@compact {` region (a list cut over several columns animates as one), but a `@compact {` region cannot be inside an `@anim {` region. Regions cannot be nested. A heading, `@next` or `@layout` inside a region, a region not closed by `@}`, an unknown property and a value out of range are errors.
102
+ - In an `@layout`, the paragraphs and lists of a cell share a text frame, except across the border of a region.
103
+ - With `@reveal`, the animations play on the last slide of the sequence, once every row is revealed; the slides before it show the `from` values.
104
+ - The animations only exist in the slideshow: the edit view, the printouts and a PDF export show every shape in its static state, fully visible. They can be tweaked afterwards in the Animation sidebar of Impress (they show up as "Transparency" and "Grow and Shrink" effects).
105
+
60
106
  ## Styles
61
107
 
62
108
  Every element of the slides uses a named style, so it can also be changed afterwards in LibreOffice (Styles sidebar: _Drawing Styles_ and _Presentation Styles_).
@@ -75,16 +121,17 @@ The first conversion of `foo.md` writes `foo.style.json` with the complete defau
75
121
  { "theme": { "colors": { "primary": "#800020" } } }
76
122
  ```
77
123
 
78
- The file has six top-level sections:
124
+ The file has seven top-level sections:
79
125
 
80
126
  | Key | Content |
81
127
  | --- | --- |
82
128
  | `theme` | Colors, fonts, font sizes, slide geometry and diagram options. |
83
129
  | `styles` | Every named style, with ODF properties. |
84
130
  | `tableTemplates` | Which cell styles a table uses for its header, body and banded rows. |
85
- | `spanStyles` | Inline formatting: bold, italic, code. |
131
+ | `spanStyles` | Inline formatting: bold, italic, code, strikethrough (`T_s`, for `~~text~~`). |
86
132
  | `markers` | Line ends (arrows) used by diagram edges. |
87
133
  | `dashes` | Dash patterns used by diagram edges and shapes. |
134
+ | `boxes` | The boxes of `@box <name> {`. |
88
135
 
89
136
  ### Theme
90
137
 
@@ -97,8 +144,9 @@ The theme gathers the values that are used in several places. Changing it is the
97
144
  | `primary` | `#1F3A5F` | Slide titles, section background, table headers, quote text and border, diagram node borders. |
98
145
  | `accent` | `#E8833A` | Left bar of content slides, line under section titles, bullets. |
99
146
  | `ink` | `#222222` | Body text, code, diagram edges. |
100
- | `muted` | `#7A8899` | Breadcrumb, prompt shadow, diagram clusters. |
101
- | `subtitle` | `#FFD8B0` | Breadcrumb shown under the title of a section slide. |
147
+ | `muted` | `#7A8899` | Breadcrumb, prompt shadow, diagram clusters, horizontal rules. |
148
+ | `subtitle` | `#FFD8B0` | Sections in the hierarchy box of a section slide. |
149
+ | `sectionHighlight` | `#FF9F43` | Highlighted section in the hierarchy box of a section slide (`T_section`). |
102
150
  | `white` | `#FFFFFF` | Section titles, table header text, table cells. |
103
151
  | `quoteBackground` | `#F1F4F8` | Blockquotes. |
104
152
  | `promptBackground` | `#DCEBFF` | ` ```prompt ` chat bubbles. |
@@ -142,7 +190,7 @@ Font sizes, in points. They are not only applied to the text: they are also used
142
190
  | --- | --- | --- |
143
191
  | `title` | 34 | Title of content slides. |
144
192
  | `sectionTitle` | 44 | Title of section slides (`#` headings). |
145
- | `subtitle` | 20 | Breadcrumb under a section title. |
193
+ | `subtitle` | 20 | Hierarchy box of section slides. |
146
194
  | `breadcrumb` | 14 | Breadcrumb above the title of content slides. |
147
195
  | `text` | 24 | Paragraphs. |
148
196
  | `list` | `[24, 21, 18, …]` | List items, one size per level (9 levels). |
@@ -257,6 +305,7 @@ Since styles inherit from each other, changing a parent changes all its children
257
305
  | `Prompt` | ` ```prompt ` code blocks (chat bubbles). |
258
306
  | `Code` | Other code blocks. |
259
307
  | `Image` | Frame of images. |
308
+ | `Separateur` | Horizontal rules (`----`). |
260
309
  | `Tableau-cadre` | Frame around tables. |
261
310
  | `Decor` | Vertical bar on the left of the slide. |
262
311
  | `Master-image` | Background image (`theme.backgrounds.Master`). |
@@ -268,7 +317,7 @@ Since styles inherit from each other, changing a parent changes all its children
268
317
  | Style | Element |
269
318
  | --- | --- |
270
319
  | `Section-title` | Title: always the `#` heading. |
271
- | `Section-subtitle` | Breadcrumb of the deeper headings, under the title. |
320
+ | `Section-subtitle` | Box of the hierarchy of the sections, under the title (semi-transparent background). The sections are a bulleted list, always left aligned, nested by depth; its `bullets` define the bullets (color `sectionHighlight` by default). |
272
321
  | `Section-fond` | Full-slide background rectangle. |
273
322
  | `Section-image` | Background image (`theme.backgrounds.Section`), above `Section-fond`. |
274
323
  | `Decor` | Horizontal bar under the title. |
@@ -396,6 +445,7 @@ Impress has no character styles, so inline formatting is defined in `spanStyles`
396
445
  | `T_i` | `*italic*` |
397
446
  | `T_bi` | `***bold italic***` |
398
447
  | `T_code` | `` `code` `` |
448
+ | `T_section` | Highlighted section in the hierarchy box of a section slide. |
399
449
 
400
450
  For instance, to show inline code in color on a light background:
401
451
 
@@ -420,6 +470,52 @@ Like everything else, span styles are merged with the defaults: here `T_code` ke
420
470
 
421
471
  The **first** entry of `dashes` (`Tirets` by default) is used for `@graph` nodes and edges with `style=dashed` or `style=dotted`.
422
472
 
473
+ ### Boxes
474
+
475
+ `boxes` defines the boxes of `@box <name> { … @}`. Boxes can be nested, each `@}` closing the innermost open box:
476
+
477
+ ```md
478
+ @box prompt-assistant {
479
+ Voici la question posée à l'assistant :
480
+
481
+ @box terminal {
482
+ $ claude "Y a-t-il une jurisprudence ?"
483
+ @}
484
+
485
+ Et sa réponse : il y a bien une jurisprudence du … qui dit …
486
+ @}
487
+ ```
488
+
489
+ ```json
490
+ "boxes": {
491
+ "prompt-assistant": {
492
+ "background": "#1F3A5F",
493
+ "border": "0.05cm dashed {colors.accent}",
494
+ "radius": "0.5cm",
495
+ "shadow": "0.15cm 0.15cm 0.2cm #000000 40%",
496
+ "padding": "0.4cm 0.6cm",
497
+ "margin": "0cm",
498
+ "font": "sans",
499
+ "size": "{sizes.text}pt"
500
+ }
501
+ }
502
+ ```
503
+
504
+ | Key | Value |
505
+ | --- | --- |
506
+ | `background` | Fill color, `#RRGGBB` or `#RGB` (required). |
507
+ | `color` | Text color, also used for the bullets and numbers of the lists. Missing or `""`: black or white, whichever is more readable on the background. |
508
+ | `border` | `none`, or as in CSS `<width> <solid\|dashed> <color>`, in any order. A dashed border uses the first entry of `dashes`. |
509
+ | `radius` | Radius of the corners, e.g. `0.3cm` (`0cm` for square corners). |
510
+ | `shadow` | `none`, or `<x> <y> [<blur>] <color> [<opacity>]`, e.g. `0.1cm 0.1cm 0.3cm #000000 30%`. |
511
+ | `padding` | Room between the border and the content: `<all>` or `<vertical> <horizontal>` (default `0.4cm 0.6cm`). |
512
+ | `margin` | Room around the box, outside its border: `<all>` or `<vertical> <horizontal>` (default `0cm`). A horizontal margin makes the box narrower than its column; a nested box is also separated by 0.2cm from what follows it. |
513
+ | `font` | Font of the text: `sans` (default, `theme.fonts.sans`), `mono` (`theme.fonts.mono`, e.g. for a terminal or some code) or the name of any installed font family, e.g. `Liberation Serif`. |
514
+ | `size` | Font size of the text (default `{sizes.text}pt`), e.g. `{sizes.code}pt` or `18pt`. |
515
+ | `graphic`, `paragraph`, `text` | Optional ODF properties, merged over those built from the values above, e.g. `"text": { "fo:font-style": "italic", "fo:font-weight": "bold" }`. |
516
+
517
+ Lengths are in `cm`, `mm`, `pt` or `in`, and every value can use [placeholders](#placeholders). Each box `<name>` becomes the named drawing style `Box-<name>` (content vertically centered, text shrunk if it does not fit), so it can also be changed in LibreOffice afterwards; a style `Box-<name>` in `styles` is merged over it. A box without nested boxes is one shape holding its text. A box holding other boxes is an empty shape, with its nested boxes and its text frames (style `Box-<name>-texte`: the text of `Box-<name>` without fill, border, shadow or padding) drawn over it. Three boxes come by default: `info` (light, with an automatic text color), `warning` (orange with white text) and `terminal` (dark, monospace text of `{sizes.code}pt`, to put in another box).
518
+
423
519
  ### Recipes
424
520
 
425
521
  Bigger text everywhere: