@slidev/parser 0.48.0-beta.22 → 0.48.0-beta.24
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-LDPCYGJA.mjs → chunk-OWSVF5RT.mjs} +13 -10
- package/dist/core.mjs +1 -1
- package/dist/fs.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -35,6 +35,11 @@ var isObject = (val) => toString(val) === "[object Object]";
|
|
|
35
35
|
function slash(str) {
|
|
36
36
|
return str.replace(/\\/g, "/");
|
|
37
37
|
}
|
|
38
|
+
function ensurePrefix(prefix, str) {
|
|
39
|
+
if (!str.startsWith(prefix))
|
|
40
|
+
return prefix + str;
|
|
41
|
+
return str;
|
|
42
|
+
}
|
|
38
43
|
function objectMap(obj, fn) {
|
|
39
44
|
return Object.fromEntries(
|
|
40
45
|
Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)
|
|
@@ -82,7 +87,7 @@ function getDefaultConfig() {
|
|
|
82
87
|
titleTemplate: "%s - Slidev",
|
|
83
88
|
addons: [],
|
|
84
89
|
remoteAssets: false,
|
|
85
|
-
monaco:
|
|
90
|
+
monaco: true,
|
|
86
91
|
monacoTypesSource: "local",
|
|
87
92
|
monacoTypesAdditionalPackages: [],
|
|
88
93
|
download: false,
|
|
@@ -250,18 +255,18 @@ function stringify(data) {
|
|
|
250
255
|
}
|
|
251
256
|
function stringifySlide(data, idx = 0) {
|
|
252
257
|
return data.raw.startsWith("---") || idx === 0 ? data.raw : `---
|
|
253
|
-
${
|
|
254
|
-
${data.raw}`}`;
|
|
258
|
+
${ensurePrefix("\n", data.raw)}`;
|
|
255
259
|
}
|
|
256
260
|
function prettifySlide(data) {
|
|
257
|
-
data.content
|
|
261
|
+
const trimed = data.content.trim();
|
|
262
|
+
data.content = trimed ? `
|
|
258
263
|
${data.content.trim()}
|
|
259
|
-
|
|
260
|
-
data.raw =
|
|
261
|
-
${
|
|
264
|
+
` : "";
|
|
265
|
+
data.raw = data.frontmatterRaw ? data.frontmatterStyle === "yaml" ? `\`\`\`yaml
|
|
266
|
+
${data.frontmatterRaw.trim()}
|
|
262
267
|
\`\`\`
|
|
263
268
|
${data.content}` : `---
|
|
264
|
-
${
|
|
269
|
+
${data.frontmatterRaw.trim()}
|
|
265
270
|
---
|
|
266
271
|
${data.content}` : data.content;
|
|
267
272
|
if (data.note)
|
|
@@ -270,8 +275,6 @@ ${data.content}` : data.content;
|
|
|
270
275
|
${data.note.trim()}
|
|
271
276
|
-->
|
|
272
277
|
`;
|
|
273
|
-
else
|
|
274
|
-
data.raw += "\n";
|
|
275
278
|
return data;
|
|
276
279
|
}
|
|
277
280
|
function prettify(data) {
|
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.48.0-beta.
|
|
3
|
+
"version": "0.48.0-beta.24",
|
|
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.48.0-beta.
|
|
43
|
+
"@slidev/types": "0.48.0-beta.24"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts",
|