@umami/shiso 1.11.0 → 1.13.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.
Files changed (148) hide show
  1. package/bin/shiso.mjs +20 -1
  2. package/dist/chunks/App.js +412 -51
  3. package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
  4. package/dist/chunks/arc.js +130 -0
  5. package/dist/chunks/architecture-7GRP2DOG.js +4 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
  7. package/dist/chunks/array.js +8 -0
  8. package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
  9. package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
  10. package/dist/chunks/channel.js +9 -0
  11. package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
  12. package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
  13. package/dist/chunks/chunk-5VM5RSS4.js +21 -0
  14. package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
  15. package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
  16. package/dist/chunks/chunk-F27PBJKO.js +95 -0
  17. package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
  18. package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
  19. package/dist/chunks/chunk-GVQU2GXP.js +58 -0
  20. package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
  21. package/dist/chunks/chunk-JWPE2WC7.js +12 -0
  22. package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
  23. package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
  24. package/dist/chunks/chunk-P2QGCYS3.js +95 -0
  25. package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
  26. package/dist/chunks/chunk-PWAF6VOD.js +467 -0
  27. package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
  28. package/dist/chunks/chunk-SVP7TREG.js +686 -0
  29. package/dist/chunks/chunk-TICWLB2K.js +3800 -0
  30. package/dist/chunks/chunk-XXDRQBXY.js +12 -0
  31. package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
  32. package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
  33. package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
  34. package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
  35. package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
  36. package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
  37. package/dist/chunks/cytoscape.esm.js +28282 -0
  38. package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
  39. package/dist/chunks/dagre.js +4235 -0
  40. package/dist/chunks/defaultLocale.js +246 -0
  41. package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
  42. package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
  43. package/dist/chunks/diagram-VSXAHHWV.js +553 -0
  44. package/dist/chunks/diagram-VX7I27RA.js +798 -0
  45. package/dist/chunks/diagram-Z3DM3KII.js +186 -0
  46. package/dist/chunks/dist.js +92 -0
  47. package/dist/chunks/docs.js +989 -93
  48. package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
  49. package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
  50. package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
  51. package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
  52. package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
  53. package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
  54. package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
  55. package/dist/chunks/graphlib.js +4194 -0
  56. package/dist/chunks/info-A6RAGUB7.js +4 -0
  57. package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
  58. package/dist/chunks/init.js +14 -0
  59. package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
  60. package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
  61. package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
  62. package/dist/chunks/katex.js +26463 -0
  63. package/dist/chunks/line.js +48 -0
  64. package/dist/chunks/linear.js +391 -0
  65. package/dist/chunks/mermaid-parser.core.js +754 -0
  66. package/dist/chunks/mermaid.core.js +4898 -0
  67. package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
  68. package/dist/chunks/ordinal.js +84 -0
  69. package/dist/chunks/packet-AYTQ26CC.js +4 -0
  70. package/dist/chunks/path.js +106 -0
  71. package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
  72. package/dist/chunks/pie-WAS4IAKB.js +4 -0
  73. package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
  74. package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
  75. package/dist/chunks/radar-RG4KPBEZ.js +4 -0
  76. package/dist/chunks/railroad-74A4TZTK.js +4 -0
  77. package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
  78. package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
  79. package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
  80. package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
  81. package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
  82. package/dist/chunks/rough.esm.js +1396 -0
  83. package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
  84. package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
  85. package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
  86. package/dist/chunks/src.js +2653 -0
  87. package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
  88. package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
  89. package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
  90. package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
  91. package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
  92. package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
  93. package/dist/chunks/treemap-WGGIJYW6.js +4 -0
  94. package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
  95. package/dist/chunks/wardley-WFR3VGLG.js +4 -0
  96. package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
  97. package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
  98. package/dist/components.js +2 -2
  99. package/dist/entry-client.js +2 -2
  100. package/dist/entry-server.js +31 -3
  101. package/docs.schema.json +90 -0
  102. package/mdx.config.ts +13 -97
  103. package/package.json +6 -4
  104. package/scripts/build-runtime.mjs +1 -0
  105. package/scripts/check-content.mjs +358 -0
  106. package/scripts/expand-navigation-globs.mjs +277 -0
  107. package/scripts/expand-openapi-navigation.mjs +94 -0
  108. package/scripts/generate-openapi.mjs +117 -0
  109. package/scripts/generate-search-index.mjs +31 -1
  110. package/scripts/lib/openapi.mjs +653 -0
  111. package/scripts/load-docs-config.mjs +52 -6
  112. package/scripts/load-shiso-config.mjs +45 -3
  113. package/scripts/prerender.mjs +83 -3
  114. package/scripts/vite-docs-config.mjs +27 -6
  115. package/src/App.tsx +0 -1
  116. package/src/components/CodeBlock.tsx +108 -8
  117. package/src/components/DocContent.tsx +18 -0
  118. package/src/components/Docs.tsx +45 -17
  119. package/src/components/OpenApiOperation.tsx +205 -0
  120. package/src/components/SideNav.tsx +13 -2
  121. package/src/components/docs/Changelog.tsx +163 -0
  122. package/src/components/docs/CodeGroup.tsx +6 -2
  123. package/src/components/docs/Mermaid.tsx +164 -0
  124. package/src/components/docs/Panel.tsx +23 -0
  125. package/src/components/docs/ParamField.tsx +17 -5
  126. package/src/components/docs/PropertiesTable.tsx +2 -2
  127. package/src/components/docs/ResponseField.tsx +17 -5
  128. package/src/components/docs/Tiles.tsx +59 -0
  129. package/src/components/docs/Tree.tsx +359 -0
  130. package/src/components/docs/Update.tsx +72 -0
  131. package/src/components/docs/index.ts +7 -0
  132. package/src/components/docs/panel-context.tsx +25 -0
  133. package/src/components/docs/styles.ts +49 -0
  134. package/src/components/icons/index.ts +4 -0
  135. package/src/entry-server.tsx +50 -0
  136. package/src/lib/code-blocks.ts +18 -0
  137. package/src/lib/code-meta.ts +87 -0
  138. package/src/lib/docs-config.ts +4 -1
  139. package/src/lib/openapi.generated.ts +4 -0
  140. package/src/lib/openapi.ts +63 -0
  141. package/src/lib/rehype-shiki.ts +213 -0
  142. package/src/lib/site-model.ts +2 -0
  143. package/src/lib/types.ts +116 -2
  144. package/src/styles/global.css +63 -73
  145. package/types/components.d.ts +79 -0
  146. package/types/config.d.ts +11 -4
  147. package/vite.config.ts +49 -3
  148. package/CHANGELOG.md +0 -171
@@ -1,3 +1,3 @@
1
- import { At as Danger, Bt as AccordionGroup, Dt as CardGroup, Et as Card, Ft as WarningBanner, It as Button, Lt as Badge, Mt as Note, Nt as Tip, Ot as Callout, Pt as Warning, St as CodeGroup, _ as Tooltip, at as Tabs, bt as Column, ct as ResponseField, dt as ParamField, ft as Link, gt as Expandable, it as Tab, jt as Info, kt as Check, lt as PropertiesTable, mt as Frame, n as ZoomableImage, ot as Step, pt as Icon, st as Steps, ut as Param, xt as Columns, zt as Accordion } from "./chunks/docs.js";
1
+ import { $t as Accordion, Bt as Card, C as Tooltip, Ct as useSetPanelContent, Et as Frame, Gt as Info, Ht as Callout, Jt as Warning, Kt as Note, Mt as Column, Nt as Columns, Ot as Expandable, Pt as CodeGroup, Rt as Changelog, S as TreeFolder, Sn as mermaidSource, St as usePanelContent, Tt as Icon, Ut as Check, Vt as CardGroup, Wt as Danger, Xt as Button, Yt as WarningBanner, Zt as Badge, _ as FileTree, _t as PropertiesTable, b as Tree, bt as Panel, dt as Tiles, en as AccordionGroup, ft as Tab, gt as ResponseField, ht as Steps, mt as Step, n as ZoomableImage, pt as Tabs, qt as Tip, ut as Tile, v as FileTreeFile, vt as Param, wt as Link, x as TreeFile, xn as Mermaid, xt as PanelProvider, y as FileTreeFolder, yt as ParamField, zt as Update } from "./chunks/docs.js";
2
2
 
3
- export { Accordion, AccordionGroup, Badge, Button, Callout, Card, CardGroup, Check, CodeGroup, Column, Columns, Danger, Expandable, Frame, Icon, Info, Link, Note, Param, ParamField, PropertiesTable, ResponseField, Step, Steps, Tab, Tabs, Tip, Tooltip, Warning, WarningBanner, ZoomableImage };
3
+ export { Accordion, AccordionGroup, Badge, Button, Callout, Card, CardGroup, Changelog, Check, CodeGroup, Column, Columns, Danger, Expandable, FileTree, FileTreeFile, FileTreeFolder, Frame, Icon, Info, Link, Mermaid, Note, Panel, PanelProvider, Param, ParamField, PropertiesTable, ResponseField, Step, Steps, Tab, Tabs, Tile, Tiles, Tip, Tooltip, Tree, TreeFile, TreeFolder, Update, Warning, WarningBanner, ZoomableImage, mermaidSource, usePanelContent, useSetPanelContent };
@@ -1,5 +1,5 @@
1
- import { ar as BrowserRouter } from "./chunks/docs.js";
2
- import { m as BASE_URL, t as App } from "./chunks/App.js";
1
+ import { Sr as BrowserRouter } from "./chunks/docs.js";
2
+ import { h as BASE_URL, t as App } from "./chunks/App.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
 
5
5
  //#region src/entry-client.tsx
@@ -1,5 +1,5 @@
1
- import { hr as ABSOLUTE_URL_REGEX, lr as Router, mr as parsePath, pr as createPath } from "./chunks/docs.js";
2
- import { a as docsSite, c as getSeo, d as getDocModule, f as getLastModified, h as toAbsoluteUrl, i as docsHomeUrl, l as siteName, m as BASE_URL, n as buildHead, o as getLocaleByPathname, p as getScopeForPage, r as renderHeadToString, s as getRedirects, t as App, u as standalonePages } from "./chunks/App.js";
1
+ import { Ar as createPath, Er as Router, Mr as ABSOLUTE_URL_REGEX, jr as parsePath } from "./chunks/docs.js";
2
+ import { a as docsSite, c as getSeo, d as standalonePages, f as getDocModule, g as toAbsoluteUrl, h as BASE_URL, i as docsHomeUrl, l as siteConfig, m as getScopeForPage, n as buildHead, o as getLocaleByPathname, p as getLastModified, r as renderHeadToString, s as getRedirects, t as App, u as siteName } from "./chunks/App.js";
3
3
  import * as React$1 from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { renderToString } from "react-dom/server";
@@ -107,6 +107,33 @@ function getMarkdownPages() {
107
107
  filePath: page.filePath
108
108
  }))];
109
109
  }
110
+ /** Navigable Markdown pages used to generate llms.txt and llms-full.txt. */
111
+ function getLlmsPages() {
112
+ const { indexing } = getSeo();
113
+ const pages = [];
114
+ for (const page of docsSite.pages) {
115
+ const doc = getDocModule(page.filePath);
116
+ if (doc?.frontmatter?.noindex === true || (page.hidden || getScopeForPage(docsSite, page).hidden) && indexing !== "all") continue;
117
+ pages.push({
118
+ route: page.url,
119
+ filePath: page.filePath,
120
+ title: doc?.frontmatter?.title || page.label,
121
+ description: doc?.frontmatter?.description
122
+ });
123
+ }
124
+ for (const page of standalonePages) {
125
+ if (page.filePath.endsWith(".tsx")) continue;
126
+ const doc = getDocModule(page.filePath);
127
+ if (doc?.frontmatter?.noindex === true) continue;
128
+ pages.push({
129
+ route: page.path,
130
+ filePath: page.filePath,
131
+ title: doc?.frontmatter?.title || page.title || page.path,
132
+ description: doc?.frontmatter?.description
133
+ });
134
+ }
135
+ return pages;
136
+ }
110
137
  /**
111
138
  * Absolute URLs for the sitemap, honoring `seo.indexing` and per-page
112
139
  * noindex. Empty when the shiso.config `siteUrl` is not configured, since a sitemap
@@ -145,6 +172,7 @@ function render(url) {
145
172
  htmlAttrs: getLocaleByPathname(url)
146
173
  };
147
174
  }
175
+ const siteDescription = siteConfig.description;
148
176
 
149
177
  //#endregion
150
- export { docsHomeUrl, getMarkdownPages, getRedirects, getRoutes, getSitemapEntries, render, siteName };
178
+ export { docsHomeUrl, getLlmsPages, getMarkdownPages, getRedirects, getRoutes, getSitemapEntries, render, siteDescription, siteName };
package/docs.schema.json CHANGED
@@ -172,6 +172,37 @@
172
172
  ],
173
173
  "description": "Page eyebrow style: the section name (default) or the full navigation path.",
174
174
  "default": "section"
175
+ },
176
+ "codeBlocks": {
177
+ "type": "object",
178
+ "description": "Fenced code block defaults: line numbers and the Shiki light/dark themes.",
179
+ "additionalProperties": false,
180
+ "properties": {
181
+ "$ref": { "$ref": "#/definitions/configRef" },
182
+ "lineNumbers": {
183
+ "allOf": [{ "$ref": "#/definitions/booleanValue" }],
184
+ "description": "Show line numbers on every block. Override per block with showLineNumbers or hideLineNumbers in the fence meta.",
185
+ "default": false
186
+ },
187
+ "theme": {
188
+ "type": "object",
189
+ "description": "Bundled Shiki theme names for each color mode (https://shiki.style/themes).",
190
+ "additionalProperties": false,
191
+ "properties": {
192
+ "$ref": { "$ref": "#/definitions/configRef" },
193
+ "light": {
194
+ "allOf": [{ "$ref": "#/definitions/nonEmptyStringValue" }],
195
+ "description": "Theme used in light mode.",
196
+ "default": "github-light"
197
+ },
198
+ "dark": {
199
+ "allOf": [{ "$ref": "#/definitions/nonEmptyStringValue" }],
200
+ "description": "Theme used in dark mode.",
201
+ "default": "github-dark"
202
+ }
203
+ }
204
+ }
205
+ }
175
206
  }
176
207
  }
177
208
  },
@@ -567,6 +598,24 @@
567
598
  }
568
599
  }
569
600
  },
601
+ "api": {
602
+ "type": "object",
603
+ "description": "API reference settings: the OpenAPI spec powering openapi frontmatter pages.",
604
+ "anyOf": [{ "required": ["$ref"] }, { "required": ["spec"] }],
605
+ "additionalProperties": false,
606
+ "properties": {
607
+ "$ref": { "$ref": "#/definitions/configRef" },
608
+ "spec": {
609
+ "allOf": [{ "$ref": "#/definitions/nonEmptyStringValue" }],
610
+ "description": "Path to a local OpenAPI 3.0 or 3.1 spec (JSON or YAML), relative to the project root."
611
+ },
612
+ "directory": {
613
+ "allOf": [{ "$ref": "#/definitions/nonEmptyStringValue" }],
614
+ "description": "Folder inside the content directory for generated endpoint pages.",
615
+ "default": "api-reference"
616
+ }
617
+ }
618
+ },
570
619
  "errors": {
571
620
  "type": "object",
572
621
  "description": "Error handling settings.",
@@ -712,6 +761,8 @@
712
761
  "description": "Page reference relative to the content directory, without extension (e.g. \"components/tabs\")."
713
762
  },
714
763
  { "$ref": "#/definitions/pageObject" },
764
+ { "$ref": "#/definitions/globItem" },
765
+ { "$ref": "#/definitions/openapiItem" },
715
766
  { "$ref": "#/definitions/linkItem" },
716
767
  { "$ref": "#/definitions/group" }
717
768
  ]
@@ -736,12 +787,51 @@
736
787
  },
737
788
  "icon": { "allOf": [{ "$ref": "#/definitions/stringValue" }], "description": "Icon name shown beside the label." },
738
789
  "tag": { "allOf": [{ "$ref": "#/definitions/stringValue" }], "description": "Short label shown after the page name." },
790
+ "method": {
791
+ "anyOf": [
792
+ { "enum": ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "TRACE"] },
793
+ { "$ref": "#/definitions/configRefValue" }
794
+ ],
795
+ "description": "HTTP method badge shown after the page name on API reference pages."
796
+ },
739
797
  "hidden": {
740
798
  "allOf": [{ "$ref": "#/definitions/booleanValue" }],
741
799
  "description": "Hide from the sidebar and search. The page is still built and reachable by URL."
742
800
  }
743
801
  }
744
802
  },
803
+ "globItem": {
804
+ "type": "object",
805
+ "required": ["glob"],
806
+ "additionalProperties": false,
807
+ "properties": {
808
+ "glob": {
809
+ "allOf": [{ "$ref": "#/definitions/nonEmptyStringValue" }],
810
+ "description": "Glob relative to contentDir. Matching Markdown and MDX files are expanded into page entries; explicit page references take precedence."
811
+ },
812
+ "exclude": {
813
+ "anyOf": [
814
+ {
815
+ "type": "array",
816
+ "items": { "$ref": "#/definitions/nonEmptyStringValue" }
817
+ },
818
+ { "$ref": "#/definitions/configRefValue" }
819
+ ],
820
+ "description": "Optional glob patterns to omit from the matches."
821
+ }
822
+ }
823
+ },
824
+ "openapiItem": {
825
+ "type": "object",
826
+ "required": ["openapi"],
827
+ "additionalProperties": false,
828
+ "properties": {
829
+ "openapi": {
830
+ "anyOf": [{ "type": "boolean" }, { "$ref": "#/definitions/nonEmptyStringValue" }],
831
+ "description": "Expand API endpoints into pages: true for every tag (grouped), or a tag name for that tag's operations. Requires the api.spec setting."
832
+ }
833
+ }
834
+ },
745
835
  "linkItem": {
746
836
  "type": "object",
747
837
  "description": "An external link in the navigation tree.",
package/mdx.config.ts CHANGED
@@ -1,104 +1,19 @@
1
1
  import mdx from '@mdx-js/rollup';
2
2
  import rehypeAutolinkHeadings from 'rehype-autolink-headings';
3
- import rehypeHighlight from 'rehype-highlight';
4
3
  import rehypeSlug from 'rehype-slug';
5
4
  import remarkFrontmatter from 'remark-frontmatter';
6
5
  import remarkGfm from 'remark-gfm';
7
6
  import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
8
7
  import type { Plugin } from 'vite';
9
- import { type MdNode, toText, walkTree } from './src/lib/mdast.ts';
8
+ import { resolveCodeBlockConfig } from './src/lib/code-blocks.ts';
9
+ import { type MdNode, toText } from './src/lib/mdast.ts';
10
+ import { rehypeShiki } from './src/lib/rehype-shiki.ts';
10
11
  import { remarkToc } from './src/lib/remark-toc.ts';
12
+ import type { MdxConfig, ResolvedCodeBlockConfig } from './src/lib/types.ts';
11
13
 
12
- const SYNTHETIC_FRAGMENT = 'data-shiso-synthetic-fragment';
13
-
14
- function remarkCodeTitles() {
15
- return (tree: MdNode) => {
16
- const visit = (node: MdNode) => {
17
- if (node.type === 'code' && node.meta?.trim()) {
18
- const meta = node.meta.trim();
19
- const titleMatch = meta.match(/(?:^|\s)title=(?:"([^"]+)"|'([^']+)'|([^\s]+))/);
20
- const title = titleMatch ? titleMatch[1] || titleMatch[2] || titleMatch[3] : meta;
21
- const hProperties = (node.data?.hProperties || {}) as Record<string, unknown>;
22
- node.data = {
23
- ...node.data,
24
- hProperties: { ...hProperties, 'data-title': title },
25
- };
26
- }
27
-
28
- node.children?.forEach(visit);
29
- };
30
-
31
- visit(tree);
32
- };
33
- }
34
-
35
- function rehypeWrapJsxForHighlighting() {
36
- return (tree: MdNode) => {
37
- walkTree(tree, node => {
38
- if (node.tagName !== 'code') {
39
- return;
40
- }
41
-
42
- const properties = (node.properties || {}) as Record<string, unknown>;
43
- const className = properties.className;
44
- const classes = Array.isArray(className) ? className.map(String) : [String(className || '')];
45
- const source = toText(node);
46
-
47
- if (!classes.some(value => /\blanguage-(?:jsx|tsx)\b/.test(value))) {
48
- return;
49
- }
50
-
51
- if (!/^\s*<[A-Z][\w.]*(?:\s|>|\/)/.test(source)) {
52
- return;
53
- }
54
-
55
- properties[SYNTHETIC_FRAGMENT] = true;
56
- node.properties = properties;
57
- node.children = [{ type: 'text', value: `<>\n${source}\n</>` }];
58
- });
59
- };
60
- }
61
-
62
- function boundaryText(node: MdNode, fromEnd = false): MdNode | undefined {
63
- if (node.type === 'text' && typeof node.value === 'string') {
64
- return node;
65
- }
66
-
67
- const children = fromEnd ? [...(node.children || [])].reverse() : node.children || [];
68
- for (const child of children) {
69
- const match = boundaryText(child, fromEnd);
70
- if (match) {
71
- return match;
72
- }
73
- }
74
-
75
- return undefined;
76
- }
77
-
78
- function rehypeRemoveHighlightingFragments() {
79
- return (tree: MdNode) => {
80
- walkTree(tree, node => {
81
- if (node.tagName !== 'code') {
82
- return;
83
- }
84
-
85
- const properties = (node.properties || {}) as Record<string, unknown>;
86
- if (!properties[SYNTHETIC_FRAGMENT]) {
87
- return;
88
- }
89
-
90
- const first = boundaryText(node);
91
- const last = boundaryText(node, true);
92
- if (first?.value) {
93
- first.value = first.value.replace(/^<>\r?\n/, '');
94
- }
95
- if (last?.value) {
96
- last.value = last.value.replace(/\r?\n<\/>$/, '');
97
- }
98
-
99
- delete properties[SYNTHETIC_FRAGMENT];
100
- });
101
- };
14
+ export interface ShisoMdxOptions extends MdxConfig {
15
+ /** Resolved docs.json `styling.codeBlocks`; defaults apply when omitted. */
16
+ codeBlocks?: ResolvedCodeBlockConfig;
102
17
  }
103
18
 
104
19
  function rehypeZoomableImages() {
@@ -142,7 +57,9 @@ function rehypeZoomableImages() {
142
57
  * The MDX compilation pipeline, shared by the app build and the test runner so
143
58
  * tests exercise the same transforms the site ships with.
144
59
  */
145
- export function shisoMdx(): Plugin {
60
+ export function shisoMdx(options: ShisoMdxOptions = {}): Plugin {
61
+ const codeBlocks = options.codeBlocks || resolveCodeBlockConfig();
62
+
146
63
  return {
147
64
  // Must run before vite:react-babel so MDX is compiled to JSX first.
148
65
  enforce: 'pre',
@@ -152,13 +69,12 @@ export function shisoMdx(): Plugin {
152
69
  remarkFrontmatter,
153
70
  remarkMdxFrontmatter,
154
71
  remarkGfm,
155
- remarkCodeTitles,
72
+ ...(options.remarkPlugins || []),
156
73
  remarkToc,
157
74
  ],
158
75
  rehypePlugins: [
159
- rehypeWrapJsxForHighlighting,
160
- rehypeHighlight,
161
- rehypeRemoveHighlightingFragments,
76
+ ...(options.rehypePlugins || []),
77
+ [rehypeShiki, codeBlocks],
162
78
  rehypeZoomableImages,
163
79
  rehypeSlug,
164
80
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umami/shiso",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Open-source documentation framework for Markdown and MDX sites.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -72,6 +72,7 @@
72
72
  "@fontsource/jetbrains-mono": "^5.2.5",
73
73
  "@mdx-js/react": "^3.1.1",
74
74
  "@mdx-js/rollup": "^3.1.1",
75
+ "@shikijs/transformers": "^4.4.3",
75
76
  "@tailwindcss/vite": "^4.3.3",
76
77
  "@vitejs/plugin-react": "^6.0.5",
77
78
  "ajv": "^8.20.0",
@@ -80,24 +81,25 @@
80
81
  "cmdk": "^1.1.1",
81
82
  "estree-util-value-to-estree": "^3.5.0",
82
83
  "github-slugger": "^2.0.0",
83
- "highlight.js": "^11.11.1",
84
84
  "jiti": "^2.4.0",
85
85
  "lucide-react": "^1.28.0",
86
+ "mermaid": "^11.17.2",
86
87
  "react-router": "^8.3.0",
87
88
  "rehype-autolink-headings": "^7.1.0",
88
- "rehype-highlight": "^7.0.1",
89
89
  "rehype-slug": "^6.0.0",
90
90
  "remark-frontmatter": "^5.0.0",
91
91
  "remark-gfm": "^4.0.0",
92
92
  "remark-mdx": "^3.1.1",
93
93
  "remark-mdx-frontmatter": "^5.2.0",
94
94
  "remark-parse": "^11.0.0",
95
+ "shiki": "^4.4.3",
95
96
  "simple-icons": "^16.28.0",
96
97
  "tailwind-merge": "^3.6.0",
97
98
  "tailwindcss": "^4.3.3",
98
99
  "tw-animate-css": "^1.4.0",
99
100
  "unified": "^11.0.5",
100
- "vite": "^8.2.0"
101
+ "vite": "^8.2.0",
102
+ "yaml": "^2.9.0"
101
103
  },
102
104
  "optionalDependencies": {
103
105
  "pagefind": "^1.4.0"
@@ -10,6 +10,7 @@ const outputRoot = path.join(packageRoot, 'dist');
10
10
  const projectModules = new Set([
11
11
  '@/generated/last-modified',
12
12
  '@/lib/icon-registry.generated',
13
+ '@/lib/openapi.generated',
13
14
  '@/lib/search-index.generated',
14
15
  'virtual:shiso-docs-config',
15
16
  'virtual:shiso-config',