@cristianormazabal/triton-latex 0.1.14 → 0.1.16

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
@@ -104,6 +104,8 @@ by any character (here `|`) and an optional `\includegraphics` key list:
104
104
  | `\tritonsetup{<opts>}` | Default `\includegraphics` options (default `width=\linewidth`). |
105
105
  | `\tritoncli{<cmd>}` | CLI invocation (default `triton-latex`). |
106
106
  | `\tritontheme{<name>}` | Theme preset passed to the CLI for inline renders. |
107
+ | `\tritonthemefile{<path>}` | Load an external `.triton-theme.json` by file path. |
108
+ | `\tritonthemesdir{<dir>}` | Scan a directory for `*.triton-theme.json` files. |
107
109
  | `\tritonscale{<n>}` | Scale passed to the CLI (default `1`). |
108
110
  | `\tritoncachedir{<dir>}` | Render cache directory (default `\jobname.triton-cache`). |
109
111
  | `\triton[<opts>]{<name>}` | **Precompile fallback:** `\includegraphics` of `<dir>/<name>.pdf`. |
@@ -148,6 +150,49 @@ node dist/cli.cjs render diagram.mmd -o out.pdf --theme executive --scale 2
148
150
 
149
151
  Installed as the `triton-latex` bin when the package is linked.
150
152
 
153
+ ## External themes
154
+
155
+ Use a `.triton-theme.json` file to apply a custom colour palette and typography
156
+ to every inline diagram in your document.
157
+
158
+ ### `.sty` macros
159
+
160
+ ```latex
161
+ \tritonthemefile{.triton/themes/my-brand.triton-theme.json}
162
+ % — OR —
163
+ \tritonthemesdir{.triton/themes} % scan a directory, then use \tritontheme{name}
164
+ ```
165
+
166
+ `\tritonthemefile{<path>}` passes `--theme-file <path>` to the CLI for every
167
+ inline `\begin{triton}` render in the document. `\tritonthemesdir{<dir>}` passes
168
+ `--themes-dir <dir>`; combine it with `\tritontheme{<name>}` to select a theme by
169
+ name from the discovered registry.
170
+
171
+ ### CLI flags
172
+
173
+ ```sh
174
+ # Load a specific theme file
175
+ node dist/cli.cjs render diagram.mmd -o out.pdf \
176
+ --theme-file .triton/themes/my-brand.triton-theme.json
177
+
178
+ # Scan a directory and select by name
179
+ node dist/cli.cjs render diagram.mmd -o out.pdf \
180
+ --themes-dir .triton/themes --theme my-brand
181
+ ```
182
+
183
+ ### ⚠️ Cache caveat
184
+
185
+ The cache key includes the theme-file **path**, not its **content**. After editing
186
+ a `.triton-theme.json` in place, clear the cache before recompiling:
187
+
188
+ ```sh
189
+ latexmk -C # preferred
190
+ rm -r <jobname>.triton-cache # or manually
191
+ ```
192
+
193
+ See [docs/external-themes.md](../docs/external-themes.md) for the full format
194
+ reference, field list, built-in preset names, and cross-host worked example.
195
+
151
196
  ## Overleaf / no-shell-escape fallback
152
197
 
153
198
  Overleaf (and any compile with shell-escape disabled) can't run the CLI, so render