You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `fig` | ✅ | — | A matplotlib `Figure`, passed as `$var`. |
88
91
| `caption` | | `""` | Caption text shown below the figure. |
89
-
| `scale_ratio` | | `0.8` | Scale factor relative to the available content width. |
92
+
| `scale_ratio` | | `0.8` | Scale factor relative to the available content width. The figure image is automatically shrunk to fit the frame if it would overflow.|
90
93
91
94
:::{note}
92
95
`matplotlib`is an optional dependency — install it in the same environment as YMPrint to
@@ -141,7 +144,7 @@ _blockquote:
141
144
(block-code)=
142
145
## `_code` — Preformatted code
143
146
144
-
A **non-executable**, syntax-highlighted code block. Use this to display code or config
147
+
A **non-executable**, code block for pre-formatted text. Use this to display code or config
145
148
verbatim.
146
149
147
150
```yaml
@@ -157,6 +160,9 @@ _code:
157
160
| Parameter | Required | Meaning |
158
161
| --- | --- | --- |
159
162
| `source` | ✅ | The literal text to display. Use a YAML block scalar (`|`) to preserve line breaks. |
163
+
| `line_numbers` | | — | Show line numbers alongside the rendered source. |
164
+
| `caption` | | — | Caption shown with the rendered code. |
165
+
| `width_ratio` | | `0.75` | Width of the rendered code block relative to the content width. |
160
166
161
167
To **run** code instead of just showing it, use [`_py`](#block-py).
162
168
@@ -183,6 +189,14 @@ _py:
183
189
c = math.sin(a / b)
184
190
```
185
191
192
+
:::{note}
193
+
The `|` after `source:` tells the YAML parser that this is preformatted text, to respect the line breaks exactly as written, and that text should not be wrapped.
194
+
195
+
This is in contrast to the `>` character, often used when writing paragraph content, which allows you to break lines wherever you want in the YAML without breaking lines in the finished document.
196
+
197
+
Both the `|` and `>` character are part of the YAML spec.
198
+
:::
199
+
186
200
| Parameter | Required | Default | Meaning |
187
201
| --- | --- | --- | --- |
188
202
| `source` | ✅ | — | Python source to execute. |
@@ -194,7 +208,9 @@ _py:
194
208
195
209
:::{warning}
196
210
`_py`runs `exec()` in the **same** Python environment as YMPrint. External subprocess
197
-
isolation is not currently implemented — only run documents you trust.
211
+
isolation is not currently implemented. Only run documents you trust.
212
+
213
+
YMPrint is **not** intended to be operated as a public-facing web app.
198
214
:::
199
215
200
216
After execution the variables are usable everywhere:
@@ -292,5 +308,9 @@ Report:
292
308
- There is a 20 pt spacer above.
293
309
```
294
310
295
-
The value is the height of the space in points. A `_spacer: 0` is a handy trick to stop a
311
+
The value is the height of the space in points.
312
+
313
+
:::{tip}
314
+
A `_spacer: 0` is a handy trick to stop a
296
315
paragraph being misinterpreted as a bullet when it's immediately followed by a list.
Copy file name to clipboardExpand all lines: docs/reference/cli.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ym --help
9
9
| Command | What it does |
10
10
| --- | --- |
11
11
|[`ym convert`](#ym-convert)| Render a YAML file to a PDF once. |
12
-
|[`ym live`](#ym-live)| Render, open the PDF, and hot-reload on every save. |
12
+
|[`ym live`](#ym-live)| Render, open the PDF in Okular, which will hot-reload on every save. |
13
13
14
14
## `ym convert`
15
15
@@ -23,7 +23,7 @@ ym convert SRC [DEST] [--config-dir DIR]
23
23
| --- | --- | --- |
24
24
|`SRC`| ✅ | Path to the source YAML report. |
25
25
|`DEST`|| Output PDF path. Defaults to the source path with a `.pdf` extension, written next to the source file. |
26
-
|`--config-dir`|| Directory holding a project config file. If omitted, YMPrint searches parent directories for one. |
26
+
|`--config-dir`|| Directory holding a project config file. If omitted, YMPrint searches parent directories for one. If a config file is not found in the parent directories, the internal default configuration will take priority. |
27
27
28
28
**Examples**
29
29
@@ -47,7 +47,9 @@ On success it prints the resolved output path:
47
47
## `ym live`
48
48
49
49
Render the PDF, open it in the [Okular](https://okular.kde.org/) viewer, and rebuild
50
-
automatically whenever the source (or a watched config file) changes. Ideal for drafting.
50
+
automatically whenever the source (or the non-default config file) changes.
51
+
52
+
Ideal for live authoring.
51
53
52
54
```bash
53
55
ym live SRC [DEST] [--config-dir DIR]
@@ -60,7 +62,7 @@ ym live SRC [DEST] [--config-dir DIR]
60
62
|`--config-dir`|| Directory of config files to also watch for changes. |
61
63
62
64
**What it watches.** Live mode watches the source file and, if a config directory is in
63
-
play, the config files within it (`doctemplate.yml`, `textstyles.yml`, `tablestyles.yml`).
65
+
play, the config files within it (`config.ymprint.yml`.
64
66
When any of them changes, the PDF is re-rendered and Okular refreshes.
65
67
66
68
```bash
@@ -82,7 +84,7 @@ example `sudo apt install okular` on Debian/Ubuntu). See
82
84
## Config discovery
83
85
84
86
When you don't pass `--config-dir`, YMPrint walks **up** from the current working directory
85
-
looking for a config file (a `*.ymprint.yml` project config, or the individual
86
-
`doctemplate.yml` / `textstyles.yml` / `tablestyles.yml` files). The nearest match is used.
87
-
This lets a whole tree of documents share one project style. See
87
+
looking for a config file (a `*.ymprint.yml` project config). The nearest match is used.
88
+
89
+
This enables a whole tree of documents to share one project style. See
0 commit comments