starlight-cannoli-plugins 2.14.0 → 2.14.1

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
@@ -231,28 +231,6 @@ The following attributes can be added to the opening fence:
231
231
  ```
232
232
  ````
233
233
 
234
- ### Remark LaTeX Compile (low-level)
235
-
236
- The underlying remark plugin used by `astroLatexCompile`. Use this directly if you need to wire the transformer into a custom pipeline — most users should use `astroLatexCompile` instead.
237
-
238
- **Usage:**
239
-
240
- ```ts
241
- // astro.config.mjs
242
- import { defineConfig } from "astro/config";
243
- import { remarkLatexCompile } from "starlight-cannoli-plugins/astro-latex-compile";
244
-
245
- export default defineConfig({
246
- markdown: {
247
- remarkPlugins: [
248
- [remarkLatexCompile, { svgOutputDir: "public/static/tex-svgs" }],
249
- ],
250
- },
251
- });
252
- ```
253
-
254
- Note: when used directly (without `astroLatexCompile`), the Starlight content layer cache is not cleared automatically, so SVGs may not recompile on repeat builds in Starlight projects.
255
-
256
234
  ### Rehype Validate Links
257
235
 
258
236
  A rehype plugin that validates all internal links in your Markdown/MDX files at build time. Links without matching files will cause the build to fail.
package/dist/index.d.ts CHANGED
@@ -4,14 +4,13 @@ export { DomPatchesOptions, starlightDomPatches } from './plugins/starlight-dom-
4
4
  export { SyncDocsToPublicOptions, syncDocsToPublic } from './plugins/astro-sync-docs-to-public.js';
5
5
  export { rehypeValidateLinks } from './plugins/rehype-validate-links.js';
6
6
  export { astroNormalizePaths } from './plugins/astro-normalize-paths.js';
7
- import { RemarkLatexCompileOptions } from './plugins/astro-latex-compile.js';
8
- export { remarkLatexCompile } from './plugins/astro-latex-compile.js';
9
7
  export { expressiveCodeEmphasis } from './plugins/expressive-code-emphasis.js';
10
8
  import { AstroIntegration } from 'astro';
9
+ import { RemarkLatexCompileOptions } from './plugins/astro-latex-compile.js';
11
10
  import 'hast';
12
11
  import 'vfile';
13
- import 'mdast';
14
12
  import 'expressive-code';
13
+ import 'mdast';
15
14
 
16
15
  type TBadgeVariant = "note" | "danger" | "success" | "caution" | "tip" | "default";
17
16
  type TIndexMarker = {
package/dist/index.js CHANGED
@@ -232,6 +232,26 @@ function starlightIndexSourcedSidebar(options) {
232
232
  import fs2 from "fs";
233
233
  import { readdir, rm } from "fs/promises";
234
234
  import { join as join3, resolve as resolve2 } from "path";
235
+ var js = String.raw;
236
+ var DARK_MODE_ROTATE = "178deg";
237
+ var INJECTED_CSS = `
238
+ :root {
239
+ --cannoli-error-low: hsl(0, 70%, 94%);
240
+ --cannoli-error: hsl(0, 72%, 42%);
241
+ --cannoli-error-high: hsl(0, 72%, 28%);
242
+ }
243
+ [data-theme="dark"] {
244
+ --cannoli-error-low: hsl(0, 55%, 16%);
245
+ --cannoli-error: hsl(0, 75%, 60%);
246
+ --cannoli-error-high: hsl(0, 80%, 82%);
247
+ }
248
+ .tex-compiled {
249
+ background-color: transparent;
250
+ }
251
+ html[data-theme="dark"] .tex-compiled {
252
+ filter: invert(1) hue-rotate(${DARK_MODE_ROTATE});
253
+ }
254
+ `;
235
255
  var DATA_STORE_FILE = "data-store.json";
236
256
  function getDataStoreFile(config) {
237
257
  return new URL(DATA_STORE_FILE, config.cacheDir);
@@ -249,8 +269,17 @@ function astroLatexCompile(options) {
249
269
  return {
250
270
  name: "astro-latex-compile",
251
271
  hooks: {
252
- "astro:config:setup": async ({ command, config, updateConfig }) => {
272
+ "astro:config:setup": async ({
273
+ command,
274
+ config,
275
+ updateConfig,
276
+ injectScript
277
+ }) => {
253
278
  if (command !== "build" && command !== "dev") return;
279
+ injectScript(
280
+ "page",
281
+ js`{ const s = document.createElement("style"); s.textContent = ${JSON.stringify(INJECTED_CSS)}; document.head.appendChild(s); }`
282
+ );
254
283
  if (command === "build") {
255
284
  await clearContentLayerCache(config);
256
285
  }
@@ -299,7 +328,6 @@ export {
299
328
  astroNormalizePaths,
300
329
  expressiveCodeEmphasis,
301
330
  rehypeValidateLinks,
302
- remarkLatexCompile,
303
331
  starlightDomPatches,
304
332
  starlightIndexOnlySidebar,
305
333
  starlightIndexSourcedSidebar,
@@ -2,21 +2,6 @@
2
2
 
3
3
  $DARK_MODE_ROTATE: 178deg;
4
4
 
5
- /********** Custom Error Colors **********/
6
- // Starlight's --sl-color-red-* sit at hsl(349°) which reads as pink/magenta.
7
- // These replacements use true red (0°) for a more conventional error appearance.
8
- :root {
9
- --cannoli-error-low: hsl(0, 70%, 94%);
10
- --cannoli-error: hsl(0, 72%, 42%);
11
- --cannoli-error-high: hsl(0, 72%, 28%);
12
- }
13
-
14
- [data-theme="dark"] {
15
- --cannoli-error-low: hsl(0, 55%, 16%);
16
- --cannoli-error: hsl(0, 75%, 60%);
17
- --cannoli-error-high: hsl(0, 80%, 82%);
18
- }
19
-
20
5
  .sl-container:where(.astro-7nkwcw3z) {
21
6
  max-width: 50rem;
22
7
  }
@@ -267,11 +252,3 @@ img.note-svg {
267
252
  filter: invert(1) hue-rotate($DARK_MODE_ROTATE);
268
253
  }
269
254
  }
270
-
271
- .tex-compiled {
272
- background-color: transparent;
273
-
274
- html[data-theme="dark"] & {
275
- filter: invert(1) hue-rotate($DARK_MODE_ROTATE);
276
- }
277
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "starlight-cannoli-plugins",
3
3
  "type": "module",
4
- "version": "2.14.0",
4
+ "version": "2.14.1",
5
5
  "description": "Starlight plugins for automatic sidebar generation and link validation",
6
6
  "license": "ISC",
7
7
  "main": "./dist/index.js",