nested-markdown 0.0.12 → 0.0.14
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/Mermaid-N3HH3ZBE.js +64 -0
- package/dist/Mermaid-N3HH3ZBE.js.map +1 -0
- package/dist/chunk-Q4XP6UTR.js +47 -0
- package/dist/chunk-Q4XP6UTR.js.map +1 -0
- package/dist/index.cjs +379 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +334 -126
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -17,5 +17,13 @@ declare function expandNestedMarkdown(markdown: string, options?: {
|
|
|
17
17
|
recursionLimit?: number;
|
|
18
18
|
defaultShow?: "preview" | "code" | "both";
|
|
19
19
|
}): Promise<string>;
|
|
20
|
+
declare function expandNestedMarkdownSync(markdown: string, options?: {
|
|
21
|
+
recursionLimit?: number;
|
|
22
|
+
defaultShow?: "preview" | "code" | "both";
|
|
23
|
+
}): string;
|
|
24
|
+
type MermaidRenderer = (chart: string) => string | Promise<string>;
|
|
25
|
+
declare function preRenderMermaid(markdown: string, options?: {
|
|
26
|
+
renderMermaid?: MermaidRenderer;
|
|
27
|
+
}): Promise<string>;
|
|
20
28
|
|
|
21
|
-
export { NestedMarkdown, NestedMarkdown as default, expandNestedMarkdown };
|
|
29
|
+
export { NestedMarkdown, NestedMarkdown as default, expandNestedMarkdown, expandNestedMarkdownSync, preRenderMermaid };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,5 +17,13 @@ declare function expandNestedMarkdown(markdown: string, options?: {
|
|
|
17
17
|
recursionLimit?: number;
|
|
18
18
|
defaultShow?: "preview" | "code" | "both";
|
|
19
19
|
}): Promise<string>;
|
|
20
|
+
declare function expandNestedMarkdownSync(markdown: string, options?: {
|
|
21
|
+
recursionLimit?: number;
|
|
22
|
+
defaultShow?: "preview" | "code" | "both";
|
|
23
|
+
}): string;
|
|
24
|
+
type MermaidRenderer = (chart: string) => string | Promise<string>;
|
|
25
|
+
declare function preRenderMermaid(markdown: string, options?: {
|
|
26
|
+
renderMermaid?: MermaidRenderer;
|
|
27
|
+
}): Promise<string>;
|
|
20
28
|
|
|
21
|
-
export { NestedMarkdown, NestedMarkdown as default, expandNestedMarkdown };
|
|
29
|
+
export { NestedMarkdown, NestedMarkdown as default, expandNestedMarkdown, expandNestedMarkdownSync, preRenderMermaid };
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
-
};
|
|
14
|
-
var __export = (target, all4) => {
|
|
15
|
-
for (var name2 in all4)
|
|
16
|
-
__defProp(target, name2, { get: all4[name2], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
-
mod
|
|
33
|
-
));
|
|
34
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
35
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
36
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
37
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__export,
|
|
4
|
+
__privateAdd,
|
|
5
|
+
__privateMethod,
|
|
6
|
+
__publicField,
|
|
7
|
+
__toESM
|
|
8
|
+
} from "./chunk-Q4XP6UTR.js";
|
|
38
9
|
|
|
39
10
|
// node_modules/inline-style-parser/cjs/index.js
|
|
40
11
|
var require_cjs = __commonJS({
|
|
@@ -6677,7 +6648,10 @@ var require_parser = __commonJS({
|
|
|
6677
6648
|
});
|
|
6678
6649
|
|
|
6679
6650
|
// src/NestedMarkdown.tsx
|
|
6680
|
-
import {
|
|
6651
|
+
import {
|
|
6652
|
+
useState as useState2,
|
|
6653
|
+
useEffect as useEffect2
|
|
6654
|
+
} from "react";
|
|
6681
6655
|
|
|
6682
6656
|
// node_modules/devlop/lib/default.js
|
|
6683
6657
|
function ok() {
|
|
@@ -8326,11 +8300,11 @@ function addChildren(props, children2) {
|
|
|
8326
8300
|
}
|
|
8327
8301
|
}
|
|
8328
8302
|
}
|
|
8329
|
-
function productionCreate(_,
|
|
8303
|
+
function productionCreate(_, jsx3, jsxs3) {
|
|
8330
8304
|
return create3;
|
|
8331
8305
|
function create3(_2, type, props, key) {
|
|
8332
8306
|
const isStaticChildren = Array.isArray(props.children);
|
|
8333
|
-
const fn = isStaticChildren ? jsxs3 :
|
|
8307
|
+
const fn = isStaticChildren ? jsxs3 : jsx3;
|
|
8334
8308
|
return key ? fn(type, props, key) : fn(type, props);
|
|
8335
8309
|
}
|
|
8336
8310
|
}
|
|
@@ -28233,70 +28207,36 @@ function expandNestedMarkdownSync(markdown, options2) {
|
|
|
28233
28207
|
options2?.defaultShow
|
|
28234
28208
|
);
|
|
28235
28209
|
}
|
|
28236
|
-
|
|
28237
|
-
|
|
28238
|
-
|
|
28239
|
-
|
|
28240
|
-
|
|
28241
|
-
const
|
|
28242
|
-
|
|
28243
|
-
const
|
|
28244
|
-
|
|
28245
|
-
|
|
28246
|
-
|
|
28247
|
-
const
|
|
28248
|
-
|
|
28249
|
-
|
|
28250
|
-
|
|
28251
|
-
|
|
28252
|
-
|
|
28253
|
-
|
|
28254
|
-
|
|
28255
|
-
|
|
28256
|
-
|
|
28257
|
-
mermaidTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "default";
|
|
28258
|
-
}
|
|
28259
|
-
}
|
|
28260
|
-
mermaid.initialize({
|
|
28261
|
-
startOnLoad: false,
|
|
28262
|
-
theme: mermaidTheme,
|
|
28263
|
-
securityLevel: "loose",
|
|
28264
|
-
suppressErrorRendering: true
|
|
28265
|
-
});
|
|
28266
|
-
const { svg: svg6 } = await mermaid.render(`mermaid-${id}`, chart);
|
|
28267
|
-
if (!cancelled) {
|
|
28268
|
-
setSvg(svg6);
|
|
28269
|
-
}
|
|
28270
|
-
} catch (error) {
|
|
28271
|
-
console.error("Failed to render mermaid chart:", error);
|
|
28272
|
-
if (!cancelled) {
|
|
28273
|
-
setSvg(
|
|
28274
|
-
`<pre class="mermaid-error" style="color: var(--nmd-error, #ef4444); padding: 8px; background: var(--nmd-error-bg, #fee2e2); border-radius: 4px;">Mermaid syntax error</pre>`
|
|
28275
|
-
);
|
|
28276
|
-
}
|
|
28277
|
-
}
|
|
28278
|
-
};
|
|
28279
|
-
if (chart) {
|
|
28280
|
-
renderChart();
|
|
28210
|
+
function shouldWrapMermaid(rendered) {
|
|
28211
|
+
const trimmed = rendered.trim();
|
|
28212
|
+
return trimmed.startsWith("<svg");
|
|
28213
|
+
}
|
|
28214
|
+
async function preRenderMermaid(markdown, options2) {
|
|
28215
|
+
const renderMermaid = options2?.renderMermaid;
|
|
28216
|
+
if (!renderMermaid) return markdown;
|
|
28217
|
+
const fenceRegex = /(^|\n)([ \t]*)```mermaid[^\n]*\n([\s\S]*?)\n\2```/g;
|
|
28218
|
+
let result = "";
|
|
28219
|
+
let lastIndex = 0;
|
|
28220
|
+
for (const match of markdown.matchAll(fenceRegex)) {
|
|
28221
|
+
const [fullMatch, leadingNewline, indent2, body] = match;
|
|
28222
|
+
const start2 = match.index ?? 0;
|
|
28223
|
+
result += markdown.slice(lastIndex, start2);
|
|
28224
|
+
const chart = body.replace(/\n$/, "");
|
|
28225
|
+
try {
|
|
28226
|
+
const rendered = await renderMermaid(chart);
|
|
28227
|
+
const wrapped = shouldWrapMermaid(rendered) ? `<div class="mermaid">${rendered}</div>` : rendered;
|
|
28228
|
+
result += `${leadingNewline}${indent2}${wrapped}`;
|
|
28229
|
+
} catch {
|
|
28230
|
+
result += fullMatch;
|
|
28281
28231
|
}
|
|
28282
|
-
|
|
28283
|
-
cancelled = true;
|
|
28284
|
-
};
|
|
28285
|
-
}, [chart, id, theme]);
|
|
28286
|
-
if (!hydrated) {
|
|
28287
|
-
return /* @__PURE__ */ jsx2("pre", { className: "mermaid", children: chart });
|
|
28232
|
+
lastIndex = start2 + fullMatch.length;
|
|
28288
28233
|
}
|
|
28289
|
-
|
|
28290
|
-
|
|
28291
|
-
|
|
28292
|
-
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
28293
|
-
return /* @__PURE__ */ jsx2("pre", { className: "mermaid", children: chart });
|
|
28294
|
-
}
|
|
28295
|
-
return /* @__PURE__ */ jsx2(MermaidClient, { chart, theme });
|
|
28296
|
-
};
|
|
28234
|
+
result += markdown.slice(lastIndex);
|
|
28235
|
+
return result;
|
|
28236
|
+
}
|
|
28297
28237
|
|
|
28298
28238
|
// src/NestedMarkdown.tsx
|
|
28299
|
-
import { jsx as
|
|
28239
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
28300
28240
|
function toKebabCase(propertyName) {
|
|
28301
28241
|
if (propertyName.startsWith("--")) return propertyName;
|
|
28302
28242
|
if (propertyName.startsWith("Webkit")) {
|
|
@@ -28359,7 +28299,215 @@ var customSchema = {
|
|
|
28359
28299
|
pre: [...defaultSchema.attributes?.pre || [], ["style"]],
|
|
28360
28300
|
blockquote: [["style"]],
|
|
28361
28301
|
code: [...defaultSchema.attributes?.code || [], ["style"]],
|
|
28362
|
-
hr: [...defaultSchema.attributes?.hr || [], ["style"]]
|
|
28302
|
+
hr: [...defaultSchema.attributes?.hr || [], ["style"]],
|
|
28303
|
+
svg: [
|
|
28304
|
+
...defaultSchema.attributes?.svg || [],
|
|
28305
|
+
["width"],
|
|
28306
|
+
["height"],
|
|
28307
|
+
["viewBox"],
|
|
28308
|
+
["xmlns"],
|
|
28309
|
+
["xmlnsXlink"],
|
|
28310
|
+
["preserveAspectRatio"],
|
|
28311
|
+
["role"],
|
|
28312
|
+
["aria-hidden"],
|
|
28313
|
+
["focusable"],
|
|
28314
|
+
["className"],
|
|
28315
|
+
["style"]
|
|
28316
|
+
],
|
|
28317
|
+
g: [
|
|
28318
|
+
...defaultSchema.attributes?.g || [],
|
|
28319
|
+
["transform"],
|
|
28320
|
+
["fill"],
|
|
28321
|
+
["stroke"],
|
|
28322
|
+
["strokeWidth"],
|
|
28323
|
+
["opacity"],
|
|
28324
|
+
["className"],
|
|
28325
|
+
["style"]
|
|
28326
|
+
],
|
|
28327
|
+
path: [
|
|
28328
|
+
...defaultSchema.attributes?.path || [],
|
|
28329
|
+
["d"],
|
|
28330
|
+
["fill"],
|
|
28331
|
+
["stroke"],
|
|
28332
|
+
["strokeWidth"],
|
|
28333
|
+
["strokeLinecap"],
|
|
28334
|
+
["strokeLinejoin"],
|
|
28335
|
+
["transform"],
|
|
28336
|
+
["opacity"],
|
|
28337
|
+
["className"],
|
|
28338
|
+
["style"]
|
|
28339
|
+
],
|
|
28340
|
+
rect: [
|
|
28341
|
+
...defaultSchema.attributes?.rect || [],
|
|
28342
|
+
["x"],
|
|
28343
|
+
["y"],
|
|
28344
|
+
["width"],
|
|
28345
|
+
["height"],
|
|
28346
|
+
["rx"],
|
|
28347
|
+
["ry"],
|
|
28348
|
+
["fill"],
|
|
28349
|
+
["stroke"],
|
|
28350
|
+
["strokeWidth"],
|
|
28351
|
+
["transform"],
|
|
28352
|
+
["opacity"],
|
|
28353
|
+
["className"],
|
|
28354
|
+
["style"]
|
|
28355
|
+
],
|
|
28356
|
+
circle: [
|
|
28357
|
+
...defaultSchema.attributes?.circle || [],
|
|
28358
|
+
["cx"],
|
|
28359
|
+
["cy"],
|
|
28360
|
+
["r"],
|
|
28361
|
+
["fill"],
|
|
28362
|
+
["stroke"],
|
|
28363
|
+
["strokeWidth"],
|
|
28364
|
+
["transform"],
|
|
28365
|
+
["opacity"],
|
|
28366
|
+
["className"],
|
|
28367
|
+
["style"]
|
|
28368
|
+
],
|
|
28369
|
+
line: [
|
|
28370
|
+
...defaultSchema.attributes?.line || [],
|
|
28371
|
+
["x1"],
|
|
28372
|
+
["y1"],
|
|
28373
|
+
["x2"],
|
|
28374
|
+
["y2"],
|
|
28375
|
+
["stroke"],
|
|
28376
|
+
["strokeWidth"],
|
|
28377
|
+
["strokeLinecap"],
|
|
28378
|
+
["transform"],
|
|
28379
|
+
["opacity"],
|
|
28380
|
+
["className"],
|
|
28381
|
+
["style"]
|
|
28382
|
+
],
|
|
28383
|
+
polyline: [
|
|
28384
|
+
...defaultSchema.attributes?.polyline || [],
|
|
28385
|
+
["points"],
|
|
28386
|
+
["fill"],
|
|
28387
|
+
["stroke"],
|
|
28388
|
+
["strokeWidth"],
|
|
28389
|
+
["transform"],
|
|
28390
|
+
["opacity"],
|
|
28391
|
+
["className"],
|
|
28392
|
+
["style"]
|
|
28393
|
+
],
|
|
28394
|
+
polygon: [
|
|
28395
|
+
...defaultSchema.attributes?.polygon || [],
|
|
28396
|
+
["points"],
|
|
28397
|
+
["fill"],
|
|
28398
|
+
["stroke"],
|
|
28399
|
+
["strokeWidth"],
|
|
28400
|
+
["transform"],
|
|
28401
|
+
["opacity"],
|
|
28402
|
+
["className"],
|
|
28403
|
+
["style"]
|
|
28404
|
+
],
|
|
28405
|
+
text: [
|
|
28406
|
+
...defaultSchema.attributes?.text || [],
|
|
28407
|
+
["x"],
|
|
28408
|
+
["y"],
|
|
28409
|
+
["dx"],
|
|
28410
|
+
["dy"],
|
|
28411
|
+
["textAnchor"],
|
|
28412
|
+
["dominantBaseline"],
|
|
28413
|
+
["fontFamily"],
|
|
28414
|
+
["fontSize"],
|
|
28415
|
+
["fontWeight"],
|
|
28416
|
+
["fill"],
|
|
28417
|
+
["transform"],
|
|
28418
|
+
["className"],
|
|
28419
|
+
["style"]
|
|
28420
|
+
],
|
|
28421
|
+
tspan: [
|
|
28422
|
+
...defaultSchema.attributes?.tspan || [],
|
|
28423
|
+
["x"],
|
|
28424
|
+
["y"],
|
|
28425
|
+
["dx"],
|
|
28426
|
+
["dy"],
|
|
28427
|
+
["textAnchor"],
|
|
28428
|
+
["dominantBaseline"],
|
|
28429
|
+
["fontFamily"],
|
|
28430
|
+
["fontSize"],
|
|
28431
|
+
["fontWeight"],
|
|
28432
|
+
["fill"],
|
|
28433
|
+
["transform"],
|
|
28434
|
+
["className"],
|
|
28435
|
+
["style"]
|
|
28436
|
+
],
|
|
28437
|
+
defs: [...defaultSchema.attributes?.defs || [], ["id"]],
|
|
28438
|
+
marker: [
|
|
28439
|
+
...defaultSchema.attributes?.marker || [],
|
|
28440
|
+
["id"],
|
|
28441
|
+
["markerWidth"],
|
|
28442
|
+
["markerHeight"],
|
|
28443
|
+
["refX"],
|
|
28444
|
+
["refY"],
|
|
28445
|
+
["orient"],
|
|
28446
|
+
["markerUnits"],
|
|
28447
|
+
["viewBox"]
|
|
28448
|
+
],
|
|
28449
|
+
linearGradient: [
|
|
28450
|
+
...defaultSchema.attributes?.linearGradient || [],
|
|
28451
|
+
["id"],
|
|
28452
|
+
["x1"],
|
|
28453
|
+
["y1"],
|
|
28454
|
+
["x2"],
|
|
28455
|
+
["y2"],
|
|
28456
|
+
["gradientUnits"],
|
|
28457
|
+
["gradientTransform"]
|
|
28458
|
+
],
|
|
28459
|
+
radialGradient: [
|
|
28460
|
+
...defaultSchema.attributes?.radialGradient || [],
|
|
28461
|
+
["id"],
|
|
28462
|
+
["cx"],
|
|
28463
|
+
["cy"],
|
|
28464
|
+
["r"],
|
|
28465
|
+
["fx"],
|
|
28466
|
+
["fy"],
|
|
28467
|
+
["gradientUnits"],
|
|
28468
|
+
["gradientTransform"]
|
|
28469
|
+
],
|
|
28470
|
+
stop: [
|
|
28471
|
+
...defaultSchema.attributes?.stop || [],
|
|
28472
|
+
["offset"],
|
|
28473
|
+
["stopColor"],
|
|
28474
|
+
["stopOpacity"]
|
|
28475
|
+
],
|
|
28476
|
+
clipPath: [
|
|
28477
|
+
...defaultSchema.attributes?.clipPath || [],
|
|
28478
|
+
["id"],
|
|
28479
|
+
["clipPathUnits"]
|
|
28480
|
+
],
|
|
28481
|
+
mask: [
|
|
28482
|
+
...defaultSchema.attributes?.mask || [],
|
|
28483
|
+
["id"],
|
|
28484
|
+
["x"],
|
|
28485
|
+
["y"],
|
|
28486
|
+
["width"],
|
|
28487
|
+
["height"],
|
|
28488
|
+
["maskUnits"],
|
|
28489
|
+
["maskContentUnits"]
|
|
28490
|
+
],
|
|
28491
|
+
pattern: [
|
|
28492
|
+
...defaultSchema.attributes?.pattern || [],
|
|
28493
|
+
["id"],
|
|
28494
|
+
["x"],
|
|
28495
|
+
["y"],
|
|
28496
|
+
["width"],
|
|
28497
|
+
["height"],
|
|
28498
|
+
["patternUnits"],
|
|
28499
|
+
["patternContentUnits"],
|
|
28500
|
+
["patternTransform"]
|
|
28501
|
+
],
|
|
28502
|
+
use: [
|
|
28503
|
+
...defaultSchema.attributes?.use || [],
|
|
28504
|
+
["href"],
|
|
28505
|
+
["xlinkHref"],
|
|
28506
|
+
["x"],
|
|
28507
|
+
["y"],
|
|
28508
|
+
["width"],
|
|
28509
|
+
["height"]
|
|
28510
|
+
]
|
|
28363
28511
|
},
|
|
28364
28512
|
tagNames: [
|
|
28365
28513
|
...defaultSchema.tagNames || [],
|
|
@@ -28369,7 +28517,28 @@ var customSchema = {
|
|
|
28369
28517
|
"code",
|
|
28370
28518
|
"hr",
|
|
28371
28519
|
"blockquote",
|
|
28372
|
-
"mark"
|
|
28520
|
+
"mark",
|
|
28521
|
+
"svg",
|
|
28522
|
+
"g",
|
|
28523
|
+
"path",
|
|
28524
|
+
"rect",
|
|
28525
|
+
"circle",
|
|
28526
|
+
"line",
|
|
28527
|
+
"polyline",
|
|
28528
|
+
"polygon",
|
|
28529
|
+
"text",
|
|
28530
|
+
"tspan",
|
|
28531
|
+
"defs",
|
|
28532
|
+
"marker",
|
|
28533
|
+
"linearGradient",
|
|
28534
|
+
"radialGradient",
|
|
28535
|
+
"stop",
|
|
28536
|
+
"clipPath",
|
|
28537
|
+
"mask",
|
|
28538
|
+
"pattern",
|
|
28539
|
+
"use",
|
|
28540
|
+
"title",
|
|
28541
|
+
"desc"
|
|
28373
28542
|
]
|
|
28374
28543
|
};
|
|
28375
28544
|
var remarkForceLooseLists = () => {
|
|
@@ -28388,6 +28557,45 @@ var remarkForceLooseLists = () => {
|
|
|
28388
28557
|
visit3(tree);
|
|
28389
28558
|
};
|
|
28390
28559
|
};
|
|
28560
|
+
var MermaidRenderer = ({
|
|
28561
|
+
chart,
|
|
28562
|
+
theme,
|
|
28563
|
+
className,
|
|
28564
|
+
codeProps
|
|
28565
|
+
}) => {
|
|
28566
|
+
const [MermaidComponent, setMermaidComponent] = useState2(null);
|
|
28567
|
+
useEffect2(() => {
|
|
28568
|
+
let mounted = true;
|
|
28569
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
28570
|
+
return () => {
|
|
28571
|
+
mounted = false;
|
|
28572
|
+
};
|
|
28573
|
+
}
|
|
28574
|
+
import("./Mermaid-N3HH3ZBE.js").then((mod) => {
|
|
28575
|
+
if (mounted) {
|
|
28576
|
+
setMermaidComponent(() => mod.Mermaid);
|
|
28577
|
+
}
|
|
28578
|
+
}).catch(() => {
|
|
28579
|
+
if (mounted) {
|
|
28580
|
+
setMermaidComponent(null);
|
|
28581
|
+
}
|
|
28582
|
+
});
|
|
28583
|
+
return () => {
|
|
28584
|
+
mounted = false;
|
|
28585
|
+
};
|
|
28586
|
+
}, []);
|
|
28587
|
+
if (!MermaidComponent) {
|
|
28588
|
+
return /* @__PURE__ */ jsx2("pre", { className: "nmd-pre", children: /* @__PURE__ */ jsx2(
|
|
28589
|
+
"code",
|
|
28590
|
+
{
|
|
28591
|
+
...codeProps,
|
|
28592
|
+
className: [className, "nmd-code"].filter(Boolean).join(" "),
|
|
28593
|
+
children: chart
|
|
28594
|
+
}
|
|
28595
|
+
) });
|
|
28596
|
+
}
|
|
28597
|
+
return /* @__PURE__ */ jsx2(MermaidComponent, { chart, theme });
|
|
28598
|
+
};
|
|
28391
28599
|
var NestedMarkdown = ({
|
|
28392
28600
|
content: content3,
|
|
28393
28601
|
children: children2,
|
|
@@ -28401,7 +28609,7 @@ var NestedMarkdown = ({
|
|
|
28401
28609
|
...reactMarkdownProps
|
|
28402
28610
|
}) => {
|
|
28403
28611
|
const markdownSource = content3 ?? children2 ?? "";
|
|
28404
|
-
const [expandedMarkdown, setExpandedMarkdown] =
|
|
28612
|
+
const [expandedMarkdown, setExpandedMarkdown] = useState2(() => {
|
|
28405
28613
|
try {
|
|
28406
28614
|
return expandNestedMarkdownSync(markdownSource, { defaultShow });
|
|
28407
28615
|
} catch (err) {
|
|
@@ -28409,7 +28617,7 @@ var NestedMarkdown = ({
|
|
|
28409
28617
|
return markdownSource;
|
|
28410
28618
|
}
|
|
28411
28619
|
});
|
|
28412
|
-
|
|
28620
|
+
useEffect2(() => {
|
|
28413
28621
|
let mounted = true;
|
|
28414
28622
|
const process = async () => {
|
|
28415
28623
|
try {
|
|
@@ -28430,36 +28638,34 @@ var NestedMarkdown = ({
|
|
|
28430
28638
|
};
|
|
28431
28639
|
}, [content3, children2, defaultShow]);
|
|
28432
28640
|
const defaultComponents = {
|
|
28433
|
-
a: ({ node: node2, ...props }) => /* @__PURE__ */
|
|
28641
|
+
a: ({ node: node2, ...props }) => /* @__PURE__ */ jsx2(
|
|
28434
28642
|
"a",
|
|
28435
28643
|
{
|
|
28436
28644
|
...props,
|
|
28437
28645
|
rel: props.target === "_blank" ? "noopener noreferrer" : props.rel
|
|
28438
28646
|
}
|
|
28439
28647
|
),
|
|
28440
|
-
table: ({ node: node2, ...props }) => /* @__PURE__ */
|
|
28441
|
-
th: ({ node: node2, ...props }) => /* @__PURE__ */
|
|
28442
|
-
td: ({ node: node2, ...props }) => /* @__PURE__ */
|
|
28443
|
-
pre: ({ node: node2, ...props }) => /* @__PURE__ */
|
|
28648
|
+
table: ({ node: node2, ...props }) => /* @__PURE__ */ jsx2("div", { className: "nmd-table-wrap", children: /* @__PURE__ */ jsx2("table", { className: "nmd-table", ...props }) }),
|
|
28649
|
+
th: ({ node: node2, ...props }) => /* @__PURE__ */ jsx2("th", { className: "nmd-th", ...props }),
|
|
28650
|
+
td: ({ node: node2, ...props }) => /* @__PURE__ */ jsx2("td", { className: "nmd-td", ...props }),
|
|
28651
|
+
pre: ({ node: node2, ...props }) => /* @__PURE__ */ jsx2("pre", { className: "nmd-pre", ...props }),
|
|
28444
28652
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28445
28653
|
code: ({ node: node2, inline: inline2, className: className2, children: children3, ...props }) => {
|
|
28446
28654
|
const match = /language-(\w+)/.exec(className2 || "");
|
|
28447
28655
|
const isMermaid = match && match[1] === "mermaid";
|
|
28448
28656
|
if (!inline2 && isMermaid) {
|
|
28449
28657
|
const chart = String(children3).replace(/\n$/, "");
|
|
28450
|
-
|
|
28451
|
-
|
|
28452
|
-
|
|
28453
|
-
|
|
28454
|
-
|
|
28455
|
-
|
|
28456
|
-
|
|
28457
|
-
|
|
28458
|
-
|
|
28459
|
-
}
|
|
28460
|
-
return /* @__PURE__ */ jsx3(Mermaid, { chart, theme: theme === "auto" ? void 0 : theme });
|
|
28658
|
+
return /* @__PURE__ */ jsx2(
|
|
28659
|
+
MermaidRenderer,
|
|
28660
|
+
{
|
|
28661
|
+
chart,
|
|
28662
|
+
theme: theme === "auto" ? void 0 : theme,
|
|
28663
|
+
className: className2,
|
|
28664
|
+
codeProps: props
|
|
28665
|
+
}
|
|
28666
|
+
);
|
|
28461
28667
|
}
|
|
28462
|
-
return /* @__PURE__ */
|
|
28668
|
+
return /* @__PURE__ */ jsx2(
|
|
28463
28669
|
"code",
|
|
28464
28670
|
{
|
|
28465
28671
|
...props,
|
|
@@ -28475,7 +28681,7 @@ var NestedMarkdown = ({
|
|
|
28475
28681
|
if (src && !src.startsWith("http") && !src.startsWith("/") && !src.startsWith("data:")) {
|
|
28476
28682
|
src = `/${src}`;
|
|
28477
28683
|
}
|
|
28478
|
-
return /* @__PURE__ */
|
|
28684
|
+
return /* @__PURE__ */ jsx2(
|
|
28479
28685
|
"img",
|
|
28480
28686
|
{
|
|
28481
28687
|
...imgProps,
|
|
@@ -28486,7 +28692,7 @@ var NestedMarkdown = ({
|
|
|
28486
28692
|
);
|
|
28487
28693
|
},
|
|
28488
28694
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28489
|
-
blockquote: ({ node: node2, ...props }) => /* @__PURE__ */
|
|
28695
|
+
blockquote: ({ node: node2, ...props }) => /* @__PURE__ */ jsx2("blockquote", { className: "nmd-blockquote", ...props })
|
|
28490
28696
|
};
|
|
28491
28697
|
const mergedComponents = { ...defaultComponents, ...components };
|
|
28492
28698
|
const mergedRemarkPlugins = [
|
|
@@ -28724,9 +28930,9 @@ var NestedMarkdown = ({
|
|
|
28724
28930
|
style: style2,
|
|
28725
28931
|
"data-theme": theme,
|
|
28726
28932
|
children: [
|
|
28727
|
-
/* @__PURE__ */
|
|
28933
|
+
/* @__PURE__ */ jsx2("style", { children: `${stylesheet}
|
|
28728
28934
|
${autoDarkStylesheet}` }),
|
|
28729
|
-
/* @__PURE__ */
|
|
28935
|
+
/* @__PURE__ */ jsx2(
|
|
28730
28936
|
Markdown,
|
|
28731
28937
|
{
|
|
28732
28938
|
...reactMarkdownProps,
|
|
@@ -28744,7 +28950,9 @@ var NestedMarkdown_default = NestedMarkdown;
|
|
|
28744
28950
|
export {
|
|
28745
28951
|
NestedMarkdown,
|
|
28746
28952
|
NestedMarkdown_default as default,
|
|
28747
|
-
expandNestedMarkdown
|
|
28953
|
+
expandNestedMarkdown,
|
|
28954
|
+
expandNestedMarkdownSync,
|
|
28955
|
+
preRenderMermaid
|
|
28748
28956
|
};
|
|
28749
28957
|
/*! Bundled license information:
|
|
28750
28958
|
|