@aiquants/markdown 1.18.0 → 2.0.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/dist/index.server.cjs +1 -1
- package/dist/index.server.cjs.map +1 -1
- package/dist/index.server.d.ts +9 -3
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +151 -254
- package/dist/index.server.js.map +1 -1
- package/package.json +7 -9
- package/dist/plugins/remark-import-directive.async.server.d.ts +0 -16
- package/dist/plugins/remark-import-directive.async.server.d.ts.map +0 -1
- package/dist/plugins/remark-resolve-uri.async.d.ts +0 -13
- package/dist/plugins/remark-resolve-uri.async.d.ts.map +0 -1
- package/dist/plugins/transformUri.async.server.d.ts +0 -13
- package/dist/plugins/transformUri.async.server.d.ts.map +0 -1
package/dist/index.server.js
CHANGED
|
@@ -1,156 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
import { createClient as z } from "@connectrpc/connect";
|
|
15
|
-
import { createConnectTransport as G } from "@connectrpc/connect-node";
|
|
16
|
-
import { Message as E, proto3 as d, MethodKind as Z } from "@bufbuild/protobuf";
|
|
17
|
-
const H = async (e) => {
|
|
1
|
+
import { load as C } from "cheerio";
|
|
2
|
+
import { L as R } from "./simple-logger-DIfMY3fH.js";
|
|
3
|
+
import { visit as D } from "unist-util-visit";
|
|
4
|
+
import { spawn as I } from "node:child_process";
|
|
5
|
+
import { existsSync as g, unlinkSync as E } from "node:fs";
|
|
6
|
+
import { createRequire as L } from "node:module";
|
|
7
|
+
import * as $ from "node:net";
|
|
8
|
+
import * as T from "node:path";
|
|
9
|
+
import { fileURLToPath as F } from "node:url";
|
|
10
|
+
import { createClient as q } from "@connectrpc/connect";
|
|
11
|
+
import { createConnectTransport as K } from "@connectrpc/connect-node";
|
|
12
|
+
import { Message as v, proto3 as i, MethodKind as j } from "@bufbuild/protobuf";
|
|
13
|
+
const U = async (r) => {
|
|
18
14
|
try {
|
|
19
|
-
const t = new AbortController(),
|
|
20
|
-
if (clearTimeout(
|
|
15
|
+
const t = new AbortController(), e = setTimeout(() => t.abort(), 1e4), l = await fetch(r, { signal: t.signal });
|
|
16
|
+
if (clearTimeout(e), !l.ok)
|
|
21
17
|
return null;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
for (const
|
|
26
|
-
const m =
|
|
27
|
-
m === "og:site_name" && (
|
|
18
|
+
const a = await l.text(), n = { url: r }, s = C(a), o = s("title").text().trim();
|
|
19
|
+
n.title = o;
|
|
20
|
+
const y = s("meta");
|
|
21
|
+
for (const c of y) {
|
|
22
|
+
const m = c.attribs.property;
|
|
23
|
+
m === "og:site_name" && (n.site_name = c.attribs.content || void 0), m === "og:title" && (n.title = c.attribs.content || o), m === "og:description" && (n.description = c.attribs.content || void 0), m === "og:image" && (n.image = c.attribs.content || void 0), m === "og:type" && (n.type = c.attribs.content || void 0), c.attribs.name === "description" && (n.description = c.attribs.content || void 0);
|
|
28
24
|
}
|
|
29
|
-
return
|
|
25
|
+
return n;
|
|
30
26
|
} catch (t) {
|
|
31
|
-
return
|
|
27
|
+
return R.error("Error fetching site metadata:", t), null;
|
|
32
28
|
}
|
|
33
|
-
},
|
|
34
|
-
const { enableCache: t = !0 } =
|
|
35
|
-
return async (
|
|
29
|
+
}, h = /* @__PURE__ */ new Map(), G = (r, t) => t.fetchAll ? !0 : t.urlPatterns && t.urlPatterns.length > 0 ? t.urlPatterns.some((e) => e.test(r)) : /^https?:\/\//.test(r) && !r.includes("localhost") && !r.includes("127.0.0.1"), lt = (r = {}) => {
|
|
30
|
+
const { enableCache: t = !0 } = r;
|
|
31
|
+
return async (e) => {
|
|
36
32
|
const l = [];
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
D(e, "block-link", (n) => {
|
|
34
|
+
G(n.url, r) && l.push(n);
|
|
39
35
|
});
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
if (t &&
|
|
43
|
-
const
|
|
44
|
-
|
|
36
|
+
const a = l.map(async (n) => {
|
|
37
|
+
const s = n.url;
|
|
38
|
+
if (t && h.has(s)) {
|
|
39
|
+
const o = h.get(s);
|
|
40
|
+
o && (n.data = n.data || {}, n.data.siteMetadata = o);
|
|
45
41
|
return;
|
|
46
42
|
}
|
|
47
43
|
try {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
} catch (
|
|
51
|
-
|
|
44
|
+
const o = await U(s);
|
|
45
|
+
o ? (n.data = n.data || {}, n.data.siteMetadata = o, t && h.set(s, o)) : t && h.set(s, null);
|
|
46
|
+
} catch (o) {
|
|
47
|
+
R.warn(`Failed to fetch metadata for ${s}:`, o), t && h.set(s, null);
|
|
52
48
|
}
|
|
53
49
|
});
|
|
54
|
-
await Promise.all(
|
|
50
|
+
await Promise.all(a);
|
|
55
51
|
};
|
|
56
|
-
}, X = /<!--\s+@import\s+"(.+?)"\s+-->/;
|
|
57
|
-
function gt(e) {
|
|
58
|
-
return async (t) => {
|
|
59
|
-
const { markdownFilePath: r } = e, l = w.dirname(r), s = [];
|
|
60
|
-
if (N(t, "html", (n, a, c) => {
|
|
61
|
-
if (!c || typeof a != "number")
|
|
62
|
-
return;
|
|
63
|
-
const i = n.value.match(X);
|
|
64
|
-
if (!i)
|
|
65
|
-
return;
|
|
66
|
-
const m = i[1], u = w.resolve(l, m);
|
|
67
|
-
Array.isArray(c.children) && s.push({ parent: c, index: a, absolutePath: u });
|
|
68
|
-
}), s.length === 0)
|
|
69
|
-
return;
|
|
70
|
-
const o = await Promise.all(
|
|
71
|
-
s.map(async ({ absolutePath: n }) => {
|
|
72
|
-
try {
|
|
73
|
-
const a = await I.readFile(n, "utf-8");
|
|
74
|
-
return this.parse(a);
|
|
75
|
-
} catch (a) {
|
|
76
|
-
return a && a.code === "ENOENT" ? h.warn(`[remark-import-directive] Import file not found: ${n}`) : h.error(`[remark-import-directive] Error processing import: ${n}`, a), null;
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
);
|
|
80
|
-
for (let n = s.length - 1; n >= 0; n--) {
|
|
81
|
-
const { parent: a, index: c } = s[n], i = o[n];
|
|
82
|
-
i?.children && Array.isArray(i.children) && a.children.splice(c, 1, ...i.children);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const Y = /^[a-z][a-z0-9+.-]*:/, _ = async (e, t, r, l, s = !1) => {
|
|
87
|
-
if (!e)
|
|
88
|
-
return "";
|
|
89
|
-
if (Y.test(e)) {
|
|
90
|
-
const m = e.substring(0, e.indexOf(":")).toLowerCase();
|
|
91
|
-
if (["http", "https", "mailto", "tel", "file"].includes(m))
|
|
92
|
-
return e;
|
|
93
|
-
}
|
|
94
|
-
if (e.startsWith("#") || e.startsWith("/"))
|
|
95
|
-
return e;
|
|
96
|
-
const o = decodeURIComponent(e), n = w.dirname(r), a = w.normalize(w.join(n, o)), c = w.resolve(l, a);
|
|
97
|
-
if (!c.startsWith(l) || a.startsWith(".."))
|
|
98
|
-
return h.error(`Security Alert: Attempt to access file outside project root: ${c}`), "";
|
|
99
|
-
if (s)
|
|
100
|
-
try {
|
|
101
|
-
await I.access(c);
|
|
102
|
-
} catch {
|
|
103
|
-
return h.warn(`File not found: ${c}`), "";
|
|
104
|
-
}
|
|
105
|
-
const i = a.replace(/\\/g, "/");
|
|
106
|
-
return t ? L("/assets/", i) : `?filePath=${encodeURIComponent(i)}`;
|
|
107
52
|
};
|
|
108
|
-
|
|
109
|
-
return async (t) => {
|
|
110
|
-
if (!(e?.markdownFilePath && e?.workspaceRoot)) {
|
|
111
|
-
h.warn("remark-resolve-uri-async: markdownFilePath and workspaceRoot are required. Skipping URI resolution.");
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const r = [], l = [];
|
|
115
|
-
N(t, ["image", "link", "html"], (n) => {
|
|
116
|
-
if (n.type === "html")
|
|
117
|
-
l.push(n);
|
|
118
|
-
else {
|
|
119
|
-
const a = n;
|
|
120
|
-
a.url && r.push({ node: a, isImage: a.type === "image" });
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
const s = r.map(async ({ node: n, isImage: a }) => {
|
|
124
|
-
const c = await _(n.url, a, e.markdownFilePath, e.workspaceRoot, e.validateExistence);
|
|
125
|
-
n.url = c;
|
|
126
|
-
}), o = l.map(async (n) => {
|
|
127
|
-
const a = J.load(n.value, null, !1);
|
|
128
|
-
let c = !1;
|
|
129
|
-
const i = a("img").toArray();
|
|
130
|
-
for (const u of i) {
|
|
131
|
-
const f = a(u).attr("src");
|
|
132
|
-
if (f) {
|
|
133
|
-
const p = await _(f, !0, e.markdownFilePath, e.workspaceRoot, e.validateExistence);
|
|
134
|
-
p !== f && (a(u).attr("src", p), c = !0);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
const m = a("a").toArray();
|
|
138
|
-
for (const u of m) {
|
|
139
|
-
const f = a(u).attr("href");
|
|
140
|
-
if (f) {
|
|
141
|
-
const p = await _(f, !1, e.markdownFilePath, e.workspaceRoot, e.validateExistence);
|
|
142
|
-
p !== f && (a(u).attr("href", p), c = !0);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (c) {
|
|
146
|
-
const u = a.html();
|
|
147
|
-
u && (n.value = u);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
await Promise.all([...s, ...o]);
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
class b extends E {
|
|
53
|
+
class u extends v {
|
|
154
54
|
/**
|
|
155
55
|
* @generated from field: string markdown_text = 1;
|
|
156
56
|
*/
|
|
@@ -215,11 +115,11 @@ class b extends E {
|
|
|
215
115
|
*/
|
|
216
116
|
enableZennDirectives;
|
|
217
117
|
constructor(t) {
|
|
218
|
-
super(),
|
|
118
|
+
super(), i.util.initPartial(t, this);
|
|
219
119
|
}
|
|
220
|
-
static runtime =
|
|
120
|
+
static runtime = i;
|
|
221
121
|
static typeName = "markdown.v1.ConvertRequest";
|
|
222
|
-
static fields =
|
|
122
|
+
static fields = i.util.newFieldList(() => [
|
|
223
123
|
{
|
|
224
124
|
no: 1,
|
|
225
125
|
name: "markdown_text",
|
|
@@ -255,20 +155,20 @@ class b extends E {
|
|
|
255
155
|
{ no: 9, name: "enable_embeds", kind: "scalar", T: 8, opt: !0 },
|
|
256
156
|
{ no: 10, name: "enable_zenn_directives", kind: "scalar", T: 8, opt: !0 }
|
|
257
157
|
]);
|
|
258
|
-
static fromBinary(t,
|
|
259
|
-
return new
|
|
158
|
+
static fromBinary(t, e) {
|
|
159
|
+
return new u().fromBinary(t, e);
|
|
260
160
|
}
|
|
261
|
-
static fromJson(t,
|
|
262
|
-
return new
|
|
161
|
+
static fromJson(t, e) {
|
|
162
|
+
return new u().fromJson(t, e);
|
|
263
163
|
}
|
|
264
|
-
static fromJsonString(t,
|
|
265
|
-
return new
|
|
164
|
+
static fromJsonString(t, e) {
|
|
165
|
+
return new u().fromJsonString(t, e);
|
|
266
166
|
}
|
|
267
|
-
static equals(t,
|
|
268
|
-
return
|
|
167
|
+
static equals(t, e) {
|
|
168
|
+
return i.util.equals(u, t, e);
|
|
269
169
|
}
|
|
270
170
|
}
|
|
271
|
-
class
|
|
171
|
+
class d extends v {
|
|
272
172
|
/**
|
|
273
173
|
* @generated from field: string html_content = 1;
|
|
274
174
|
*/
|
|
@@ -278,11 +178,11 @@ class k extends E {
|
|
|
278
178
|
*/
|
|
279
179
|
headings = [];
|
|
280
180
|
constructor(t) {
|
|
281
|
-
super(),
|
|
181
|
+
super(), i.util.initPartial(t, this);
|
|
282
182
|
}
|
|
283
|
-
static runtime =
|
|
183
|
+
static runtime = i;
|
|
284
184
|
static typeName = "markdown.v1.ConvertResponse";
|
|
285
|
-
static fields =
|
|
185
|
+
static fields = i.util.newFieldList(() => [
|
|
286
186
|
{
|
|
287
187
|
no: 1,
|
|
288
188
|
name: "html_content",
|
|
@@ -290,22 +190,22 @@ class k extends E {
|
|
|
290
190
|
T: 9
|
|
291
191
|
/* ScalarType.STRING */
|
|
292
192
|
},
|
|
293
|
-
{ no: 2, name: "headings", kind: "message", T:
|
|
193
|
+
{ no: 2, name: "headings", kind: "message", T: f, repeated: !0 }
|
|
294
194
|
]);
|
|
295
|
-
static fromBinary(t,
|
|
296
|
-
return new
|
|
195
|
+
static fromBinary(t, e) {
|
|
196
|
+
return new d().fromBinary(t, e);
|
|
297
197
|
}
|
|
298
|
-
static fromJson(t,
|
|
299
|
-
return new
|
|
198
|
+
static fromJson(t, e) {
|
|
199
|
+
return new d().fromJson(t, e);
|
|
300
200
|
}
|
|
301
|
-
static fromJsonString(t,
|
|
302
|
-
return new
|
|
201
|
+
static fromJsonString(t, e) {
|
|
202
|
+
return new d().fromJsonString(t, e);
|
|
303
203
|
}
|
|
304
|
-
static equals(t,
|
|
305
|
-
return
|
|
204
|
+
static equals(t, e) {
|
|
205
|
+
return i.util.equals(d, t, e);
|
|
306
206
|
}
|
|
307
207
|
}
|
|
308
|
-
class
|
|
208
|
+
class f extends v {
|
|
309
209
|
/**
|
|
310
210
|
* @generated from field: string text = 1;
|
|
311
211
|
*/
|
|
@@ -319,11 +219,11 @@ class y extends E {
|
|
|
319
219
|
*/
|
|
320
220
|
id = "";
|
|
321
221
|
constructor(t) {
|
|
322
|
-
super(),
|
|
222
|
+
super(), i.util.initPartial(t, this);
|
|
323
223
|
}
|
|
324
|
-
static runtime =
|
|
224
|
+
static runtime = i;
|
|
325
225
|
static typeName = "markdown.v1.Heading";
|
|
326
|
-
static fields =
|
|
226
|
+
static fields = i.util.newFieldList(() => [
|
|
327
227
|
{
|
|
328
228
|
no: 1,
|
|
329
229
|
name: "text",
|
|
@@ -346,20 +246,20 @@ class y extends E {
|
|
|
346
246
|
/* ScalarType.STRING */
|
|
347
247
|
}
|
|
348
248
|
]);
|
|
349
|
-
static fromBinary(t,
|
|
350
|
-
return new
|
|
249
|
+
static fromBinary(t, e) {
|
|
250
|
+
return new f().fromBinary(t, e);
|
|
351
251
|
}
|
|
352
|
-
static fromJson(t,
|
|
353
|
-
return new
|
|
252
|
+
static fromJson(t, e) {
|
|
253
|
+
return new f().fromJson(t, e);
|
|
354
254
|
}
|
|
355
|
-
static fromJsonString(t,
|
|
356
|
-
return new
|
|
255
|
+
static fromJsonString(t, e) {
|
|
256
|
+
return new f().fromJsonString(t, e);
|
|
357
257
|
}
|
|
358
|
-
static equals(t,
|
|
359
|
-
return
|
|
258
|
+
static equals(t, e) {
|
|
259
|
+
return i.util.equals(f, t, e);
|
|
360
260
|
}
|
|
361
261
|
}
|
|
362
|
-
const
|
|
262
|
+
const W = {
|
|
363
263
|
typeName: "markdown.v1.MarkdownService",
|
|
364
264
|
methods: {
|
|
365
265
|
/**
|
|
@@ -367,129 +267,126 @@ const Q = {
|
|
|
367
267
|
*/
|
|
368
268
|
convert: {
|
|
369
269
|
name: "Convert",
|
|
370
|
-
I:
|
|
371
|
-
O:
|
|
372
|
-
kind:
|
|
270
|
+
I: u,
|
|
271
|
+
O: d,
|
|
272
|
+
kind: j.Unary
|
|
373
273
|
}
|
|
374
274
|
}
|
|
375
|
-
},
|
|
275
|
+
}, p = process.env.MARKDOWN_SOCKET_PATH || "/tmp/markdown.sock", Z = K({
|
|
376
276
|
baseUrl: "http://localhost",
|
|
377
277
|
httpVersion: "2",
|
|
378
278
|
nodeOptions: {
|
|
379
|
-
createConnection: () =>
|
|
279
|
+
createConnection: () => $.connect(p)
|
|
380
280
|
}
|
|
381
|
-
}),
|
|
281
|
+
}), z = q(W, Z), N = () => {
|
|
382
282
|
try {
|
|
383
|
-
return
|
|
283
|
+
return T.dirname(F(import.meta.url));
|
|
384
284
|
} catch {
|
|
385
285
|
return __dirname;
|
|
386
286
|
}
|
|
387
|
-
},
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
return
|
|
287
|
+
}, x = () => `@aiquants/markdown-${process.platform}-${process.arch}`, A = () => process.platform === "win32" ? "bin/markdown-api.exe" : "bin/markdown-api", V = () => {
|
|
288
|
+
const r = process.env.MARKDOWN_API_BINARY;
|
|
289
|
+
if (r && g(r))
|
|
290
|
+
return r;
|
|
391
291
|
try {
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
394
|
-
return
|
|
292
|
+
const e = L(T.join(N(), "index.js")).resolve(`${x()}/${A()}`);
|
|
293
|
+
if (g(e))
|
|
294
|
+
return e;
|
|
395
295
|
} catch {
|
|
396
296
|
}
|
|
397
|
-
const t =
|
|
398
|
-
return
|
|
399
|
-
},
|
|
297
|
+
const t = T.join(N(), "..", "..", "go", "markdown-api", "dist", T.basename(A()));
|
|
298
|
+
return g(t) ? t : void 0;
|
|
299
|
+
}, Y = () => [
|
|
400
300
|
`markdown-api binary not found for ${process.platform}-${process.arch}.`,
|
|
401
|
-
`Expected the optional dependency ${
|
|
301
|
+
`Expected the optional dependency ${x()} to be installed.`,
|
|
402
302
|
"If your platform is unsupported, build the service yourself",
|
|
403
303
|
"(https://github.com/fehde-k/aiquants/tree/main/packages/go/markdown-api)",
|
|
404
304
|
"and point MARKDOWN_API_BINARY at it."
|
|
405
|
-
].join(" "),
|
|
406
|
-
const t =
|
|
305
|
+
].join(" "), J = () => new Promise((r) => {
|
|
306
|
+
const t = $.connect(p);
|
|
407
307
|
t.on("connect", () => {
|
|
408
|
-
t.destroy(),
|
|
409
|
-
}), t.on("error", () =>
|
|
410
|
-
}),
|
|
308
|
+
t.destroy(), r(!0);
|
|
309
|
+
}), t.on("error", () => r(!1));
|
|
310
|
+
}), B = async (r) => {
|
|
411
311
|
const t = Date.now();
|
|
412
|
-
for (; Date.now() - t <
|
|
413
|
-
if (await
|
|
414
|
-
await new Promise((
|
|
312
|
+
for (; Date.now() - t < r; ) {
|
|
313
|
+
if (await J()) return !0;
|
|
314
|
+
await new Promise((e) => setTimeout(e, 100));
|
|
415
315
|
}
|
|
416
316
|
return !1;
|
|
417
317
|
};
|
|
418
|
-
let
|
|
419
|
-
const
|
|
420
|
-
const
|
|
421
|
-
return Number.isFinite(
|
|
318
|
+
let w = null, k = null;
|
|
319
|
+
const X = 2e3, H = () => {
|
|
320
|
+
const r = Number(process.env.MARKDOWN_API_STARTUP_TIMEOUT_MS);
|
|
321
|
+
return Number.isFinite(r) && r > 0 ? r : 1e4;
|
|
422
322
|
};
|
|
423
|
-
let
|
|
424
|
-
const
|
|
425
|
-
if (await
|
|
426
|
-
if (
|
|
427
|
-
|
|
428
|
-
const t =
|
|
323
|
+
let M = null;
|
|
324
|
+
const Q = async () => {
|
|
325
|
+
if (await J()) return !0;
|
|
326
|
+
if (k) return k;
|
|
327
|
+
k = (async () => {
|
|
328
|
+
const t = V();
|
|
429
329
|
if (!t)
|
|
430
|
-
return await
|
|
431
|
-
|
|
330
|
+
return await B(X) ? !0 : (M = Y(), !1);
|
|
331
|
+
M = null;
|
|
432
332
|
try {
|
|
433
|
-
|
|
333
|
+
g(p) && E(p);
|
|
434
334
|
} catch {
|
|
435
335
|
}
|
|
436
336
|
try {
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
if (
|
|
337
|
+
w = I(t, [], { stdio: "ignore" });
|
|
338
|
+
const e = () => {
|
|
339
|
+
if (w) {
|
|
440
340
|
try {
|
|
441
|
-
|
|
341
|
+
w.kill("SIGTERM");
|
|
442
342
|
} catch {
|
|
443
343
|
}
|
|
444
|
-
|
|
344
|
+
w = null;
|
|
445
345
|
}
|
|
446
346
|
};
|
|
447
|
-
return process.once("exit",
|
|
448
|
-
} catch (
|
|
449
|
-
return console.error("Failed to spawn markdown-api Go server:",
|
|
347
|
+
return process.once("exit", e), await B(H()) ? !0 : (console.error("markdown-api Go server did not become ready on socket:", p), e(), process.removeListener("exit", e), !1);
|
|
348
|
+
} catch (e) {
|
|
349
|
+
return console.error("Failed to spawn markdown-api Go server:", e), w = null, !1;
|
|
450
350
|
}
|
|
451
351
|
})();
|
|
452
|
-
const
|
|
453
|
-
return
|
|
454
|
-
},
|
|
455
|
-
if (!await
|
|
456
|
-
const
|
|
457
|
-
throw new Error(`markdown service is not reachable on ${
|
|
352
|
+
const r = await k;
|
|
353
|
+
return r || (k = null), r;
|
|
354
|
+
}, mt = async (r, t, e, l, a = !0) => {
|
|
355
|
+
if (!await Q()) {
|
|
356
|
+
const b = M ? ` ${M}` : "";
|
|
357
|
+
throw new Error(`markdown service is not reachable on ${p}.${b}`);
|
|
458
358
|
}
|
|
459
|
-
let
|
|
460
|
-
typeof
|
|
461
|
-
const
|
|
462
|
-
l && (
|
|
463
|
-
const
|
|
359
|
+
let n = !0, s, o, y, c, m, S;
|
|
360
|
+
typeof a == "boolean" ? n = a : a && typeof a == "object" && (n = a.validateExistence ?? !0, s = a.enableSubscript, o = a.enableSuperscript, y = a.enableMark, c = a.enableTableMerge, m = a.enableEmbeds, S = a.enableZennDirectives);
|
|
361
|
+
const P = {};
|
|
362
|
+
l && (P.Authorization = `Bearer ${l}`);
|
|
363
|
+
const _ = await z.convert(
|
|
464
364
|
{
|
|
465
|
-
markdownText:
|
|
365
|
+
markdownText: r,
|
|
466
366
|
filePath: t,
|
|
467
|
-
workspaceRoot:
|
|
468
|
-
validateExistence:
|
|
469
|
-
enableSubscript:
|
|
470
|
-
enableSuperscript:
|
|
471
|
-
enableMark:
|
|
472
|
-
enableTableMerge:
|
|
367
|
+
workspaceRoot: e,
|
|
368
|
+
validateExistence: n,
|
|
369
|
+
enableSubscript: s,
|
|
370
|
+
enableSuperscript: o,
|
|
371
|
+
enableMark: y,
|
|
372
|
+
enableTableMerge: c,
|
|
473
373
|
enableEmbeds: m,
|
|
474
|
-
enableZennDirectives:
|
|
374
|
+
enableZennDirectives: S
|
|
475
375
|
},
|
|
476
|
-
{ headers:
|
|
376
|
+
{ headers: P }
|
|
477
377
|
);
|
|
478
378
|
return {
|
|
479
|
-
htmlContent:
|
|
480
|
-
headings:
|
|
481
|
-
text:
|
|
482
|
-
depth:
|
|
483
|
-
id:
|
|
379
|
+
htmlContent: _.htmlContent,
|
|
380
|
+
headings: _.headings.map((b) => ({
|
|
381
|
+
text: b.text,
|
|
382
|
+
depth: b.depth,
|
|
383
|
+
id: b.id
|
|
484
384
|
}))
|
|
485
385
|
};
|
|
486
386
|
};
|
|
487
387
|
export {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
gt as remarkImportDirective,
|
|
492
|
-
Tt as remarkResolveUriAsync,
|
|
493
|
-
_ as transformUriAsync
|
|
388
|
+
U as fetchSiteMetadata,
|
|
389
|
+
mt as parseMarkdown,
|
|
390
|
+
lt as remarkBlockLinkMetadata
|
|
494
391
|
};
|
|
495
392
|
//# sourceMappingURL=index.server.js.map
|