nested-markdown 0.0.10 → 0.0.12
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/dist/index.cjs +20 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -28248,7 +28248,7 @@ function expandNestedMarkdownSync(markdown, options2) {
|
|
|
28248
28248
|
// src/Mermaid.tsx
|
|
28249
28249
|
var import_react2 = require("react");
|
|
28250
28250
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
28251
|
-
var
|
|
28251
|
+
var MermaidClient = ({ chart, theme }) => {
|
|
28252
28252
|
const id = (0, import_react2.useId)().replace(/:/g, "");
|
|
28253
28253
|
const [svg5, setSvg] = (0, import_react2.useState)("");
|
|
28254
28254
|
const [hydrated, setHydrated] = (0, import_react2.useState)(false);
|
|
@@ -28264,7 +28264,7 @@ var Mermaid = ({ chart, theme }) => {
|
|
|
28264
28264
|
} else if (theme === "light") {
|
|
28265
28265
|
mermaidTheme = "default";
|
|
28266
28266
|
} else {
|
|
28267
|
-
if (typeof window !== "undefined") {
|
|
28267
|
+
if (typeof window !== "undefined" || typeof document === "undefined") {
|
|
28268
28268
|
mermaidTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "default";
|
|
28269
28269
|
}
|
|
28270
28270
|
}
|
|
@@ -28299,6 +28299,12 @@ var Mermaid = ({ chart, theme }) => {
|
|
|
28299
28299
|
}
|
|
28300
28300
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mermaid", dangerouslySetInnerHTML: { __html: svg5 } });
|
|
28301
28301
|
};
|
|
28302
|
+
var Mermaid = ({ chart, theme }) => {
|
|
28303
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
28304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("pre", { className: "mermaid", children: chart });
|
|
28305
|
+
}
|
|
28306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MermaidClient, { chart, theme });
|
|
28307
|
+
};
|
|
28302
28308
|
|
|
28303
28309
|
// src/NestedMarkdown.tsx
|
|
28304
28310
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -28451,13 +28457,18 @@ var NestedMarkdown = ({
|
|
|
28451
28457
|
const match = /language-(\w+)/.exec(className2 || "");
|
|
28452
28458
|
const isMermaid = match && match[1] === "mermaid";
|
|
28453
28459
|
if (!inline2 && isMermaid) {
|
|
28454
|
-
|
|
28455
|
-
|
|
28456
|
-
{
|
|
28457
|
-
|
|
28458
|
-
|
|
28459
|
-
|
|
28460
|
-
|
|
28460
|
+
const chart = String(children3).replace(/\n$/, "");
|
|
28461
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
28462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("pre", { className: "nmd-pre", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
28463
|
+
"code",
|
|
28464
|
+
{
|
|
28465
|
+
...props,
|
|
28466
|
+
className: [className2, "nmd-code"].filter(Boolean).join(" "),
|
|
28467
|
+
children: chart
|
|
28468
|
+
}
|
|
28469
|
+
) });
|
|
28470
|
+
}
|
|
28471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Mermaid, { chart, theme: theme === "auto" ? void 0 : theme });
|
|
28461
28472
|
}
|
|
28462
28473
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
28463
28474
|
"code",
|