starlight-cannoli-plugins 2.13.1 → 2.14.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
@@ -142,7 +142,8 @@ dvisvgm --version
142
142
 
143
143
  - `svgOutputDir` (required): Directory where compiled SVG files are written. Must be inside `public/` so Astro serves them as static assets.
144
144
  - `removeOrphanedSvgs` (optional, default: `false`): When `true`, SVG files that are no longer referenced by any `tex compile` block are deleted automatically. In dev mode, stale SVGs are removed immediately when a block is edited. On build, any remaining orphans are swept at the end.
145
- - `texInputDirs` (optional): Directories added to the TeX input search path (`TEXINPUTS`), allowing `\input{}` and `\include{}` to resolve files from your project. Use a trailing `/` to search only that directory, or `//` to search it recursively. Multiple directories are supported.
145
+ - `svgClassname` (optional): Default CSS class(es) applied to every compiled SVG `<img>` element. Individual blocks can override this with a `class` meta tag value. The `tex-compiled` class is always present and cannot be overridden.
146
+ - `texInputDirs` (optional): Directories added to the TeX input search path (`TEXINPUTS`), allowing `\input{}` and `\include{}` to resolve files from your project. Use a trailing `/` to search only that directory, or `//` to search it recursively. Multiple directories are supported. When any file in these directories changes, all cached SVGs are invalidated and recompiled.
146
147
  - `tempOutputDir` (optional): When set, a JPEG copy of each compiled diagram is written to this directory, mirroring the folder structure of `src/content/docs/`. Only blocks that carry a `blockid=<n>` meta tag produce a JPEG — blocks without it are ignored. The filename format is `<originating-file>--<blockid>--<hash>.jpg` (e.g. `tex-test.md--5--abc123.jpg`). JPEGs are deleted automatically when their block is removed, its `blockid` changes, or its content changes. SVG output is unaffected — the JPEG is complementary and intended for local inspection.
147
148
 
148
149
  ```ts
@@ -620,14 +620,15 @@ ${details}`
620
620
  continue;
621
621
  }
622
622
  const metaOptions = new MetaOptions(node.meta ?? "");
623
- const customClasses = metaOptions.getString("class")?.split(/\s+/).filter(Boolean) ?? [];
623
+ const blockClass = metaOptions.getString("class");
624
+ const extraClasses = (blockClass !== void 0 ? blockClass : options.svgClassname ?? "").split(/\s+/).filter(Boolean);
624
625
  const altText = metaOptions.getString("alt") ?? "LaTeX diagram";
625
626
  const imageNode = {
626
627
  type: "image",
627
628
  url: `/static/tex-svgs/${result.hash}.svg`,
628
629
  alt: altText,
629
630
  data: {
630
- hProperties: { className: ["tex-compiled", ...customClasses] }
631
+ hProperties: { className: ["tex-compiled", ...extraClasses] }
631
632
  }
632
633
  };
633
634
  const paragraph = {
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3UMY7T6G.js";
10
10
  import {
11
11
  remarkLatexCompile
12
- } from "./chunk-57RXO5LG.js";
12
+ } from "./chunk-ETBDUEFH.js";
13
13
  import {
14
14
  astroNormalizePaths
15
15
  } from "./chunk-TLOFSB33.js";
@@ -22,6 +22,12 @@ interface RemarkLatexCompileOptions {
22
22
  * Must be inside `public/` so Astro serves them as static assets.
23
23
  */
24
24
  svgOutputDir: string;
25
+ /**
26
+ * Default CSS class(es) applied to every compiled SVG `<img>` element.
27
+ * Individual blocks can override this with a `class` meta tag value.
28
+ * The `tex-compiled` class is always present and cannot be overridden.
29
+ */
30
+ svgClassname?: string;
25
31
  /**
26
32
  * Directories added to the TeX input search path via TEXINPUTS, allowing
27
33
  * \input{} and \include{} to resolve files from your project. Use a trailing
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  compileLatexToSvg,
3
3
  remarkLatexCompile
4
- } from "../chunk-57RXO5LG.js";
4
+ } from "../chunk-ETBDUEFH.js";
5
5
  import "../chunk-C2VXRQOK.js";
6
6
  import "../chunk-4VNS5WPM.js";
7
7
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "starlight-cannoli-plugins",
3
3
  "type": "module",
4
- "version": "2.13.1",
4
+ "version": "2.14.0",
5
5
  "description": "Starlight plugins for automatic sidebar generation and link validation",
6
6
  "license": "ISC",
7
7
  "main": "./dist/index.js",