@slidev/parser 0.47.0 → 0.47.2
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/{chunk-VVGYI2Z3.mjs → chunk-3UOELSP3.mjs} +6 -51
- package/dist/core.mjs +1 -1
- package/dist/fs.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -40,56 +40,6 @@ function objectMap(obj, fn) {
|
|
|
40
40
|
Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
var Node = class {
|
|
44
|
-
value;
|
|
45
|
-
next;
|
|
46
|
-
constructor(value) {
|
|
47
|
-
this.value = value;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var Queue = class {
|
|
51
|
-
#head;
|
|
52
|
-
#tail;
|
|
53
|
-
#size;
|
|
54
|
-
constructor() {
|
|
55
|
-
this.clear();
|
|
56
|
-
}
|
|
57
|
-
enqueue(value) {
|
|
58
|
-
const node = new Node(value);
|
|
59
|
-
if (this.#head) {
|
|
60
|
-
this.#tail.next = node;
|
|
61
|
-
this.#tail = node;
|
|
62
|
-
} else {
|
|
63
|
-
this.#head = node;
|
|
64
|
-
this.#tail = node;
|
|
65
|
-
}
|
|
66
|
-
this.#size++;
|
|
67
|
-
}
|
|
68
|
-
dequeue() {
|
|
69
|
-
const current = this.#head;
|
|
70
|
-
if (!current) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.#head = this.#head.next;
|
|
74
|
-
this.#size--;
|
|
75
|
-
return current.value;
|
|
76
|
-
}
|
|
77
|
-
clear() {
|
|
78
|
-
this.#head = void 0;
|
|
79
|
-
this.#tail = void 0;
|
|
80
|
-
this.#size = 0;
|
|
81
|
-
}
|
|
82
|
-
get size() {
|
|
83
|
-
return this.#size;
|
|
84
|
-
}
|
|
85
|
-
*[Symbol.iterator]() {
|
|
86
|
-
let current = this.#head;
|
|
87
|
-
while (current) {
|
|
88
|
-
yield current.value;
|
|
89
|
-
current = current.next;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
43
|
var VOID = Symbol("p-void");
|
|
94
44
|
|
|
95
45
|
// src/utils.ts
|
|
@@ -134,7 +84,7 @@ function getDefaultConfig() {
|
|
|
134
84
|
download: false,
|
|
135
85
|
export: {},
|
|
136
86
|
info: false,
|
|
137
|
-
highlighter: "
|
|
87
|
+
highlighter: "shiki",
|
|
138
88
|
lineNumbers: false,
|
|
139
89
|
colorSchema: "auto",
|
|
140
90
|
routerMode: "history",
|
|
@@ -336,21 +286,25 @@ function safeParseYAML(str) {
|
|
|
336
286
|
}
|
|
337
287
|
function matter(code) {
|
|
338
288
|
let type;
|
|
289
|
+
let raw;
|
|
339
290
|
const data = {};
|
|
340
291
|
let content = code.replace(/^---.*\r?\n([\s\S]*?)---/, (_, f) => {
|
|
341
292
|
type = "frontmatter";
|
|
293
|
+
raw = f;
|
|
342
294
|
Object.assign(data, safeParseYAML(f));
|
|
343
295
|
return "";
|
|
344
296
|
});
|
|
345
297
|
if (type !== "frontmatter") {
|
|
346
298
|
content = content.replace(/^\s*```ya?ml([\s\S]*?)```/, (_, d) => {
|
|
347
299
|
type = "yaml";
|
|
300
|
+
raw = d;
|
|
348
301
|
Object.assign(data, safeParseYAML(d));
|
|
349
302
|
return "";
|
|
350
303
|
});
|
|
351
304
|
}
|
|
352
305
|
return {
|
|
353
306
|
type,
|
|
307
|
+
raw,
|
|
354
308
|
data,
|
|
355
309
|
content
|
|
356
310
|
};
|
|
@@ -394,6 +348,7 @@ function parseSlide(raw) {
|
|
|
394
348
|
content,
|
|
395
349
|
frontmatter,
|
|
396
350
|
frontmatterStyle: matterResult.type,
|
|
351
|
+
frontmatterRaw: matterResult.raw,
|
|
397
352
|
note
|
|
398
353
|
};
|
|
399
354
|
}
|
package/dist/core.mjs
CHANGED
package/dist/fs.mjs
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/parser",
|
|
3
|
-
"version": "0.47.
|
|
3
|
+
"version": "0.47.2",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"js-yaml": "^4.1.0",
|
|
43
|
-
"@slidev/types": "0.47.
|
|
43
|
+
"@slidev/types": "0.47.2"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts",
|