@slidev/parser 0.49.1 → 0.49.3
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-N73CSDH6.mjs → chunk-W4Y5JOBK.mjs} +5 -5
- package/dist/core.mjs +1 -1
- package/dist/fs.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -27,7 +27,7 @@ function parseAspectRatio(str) {
|
|
|
27
27
|
return str;
|
|
28
28
|
if (!Number.isNaN(+str))
|
|
29
29
|
return +str;
|
|
30
|
-
const [wStr = "", hStr = ""] = str.split(/[
|
|
30
|
+
const [wStr = "", hStr = ""] = str.split(/[:/x|]/);
|
|
31
31
|
const w = Number.parseFloat(wStr.trim());
|
|
32
32
|
const h = Number.parseFloat(hStr.trim());
|
|
33
33
|
if (Number.isNaN(w) || Number.isNaN(h) || h === 0)
|
|
@@ -199,7 +199,7 @@ function resolveDrawings(options = {}, filepath) {
|
|
|
199
199
|
presenterOnly = false,
|
|
200
200
|
syncAll = true
|
|
201
201
|
} = options;
|
|
202
|
-
const persistPath = typeof persist === "string" ? persist : persist ? `.slidev/drawings${filepath ? `/${filepath.match(/([
|
|
202
|
+
const persistPath = typeof persist === "string" ? persist : persist ? `.slidev/drawings${filepath ? `/${filepath.match(/([^\\/]+?)(\.\w+)?$/)?.[1]}` : ""}` : false;
|
|
203
203
|
return {
|
|
204
204
|
enabled,
|
|
205
205
|
persist: persistPath,
|
|
@@ -268,7 +268,7 @@ function matter(code) {
|
|
|
268
268
|
function detectFeatures(code) {
|
|
269
269
|
return {
|
|
270
270
|
katex: !!code.match(/\$.*?\$/) || !!code.match(/\$\$/),
|
|
271
|
-
monaco: code.match(
|
|
271
|
+
monaco: code.match(/\{monaco.*\}/) ? scanMonacoReferencedMods(code) : false,
|
|
272
272
|
tweet: !!code.match(/<Tweet\b/),
|
|
273
273
|
mermaid: !!code.match(/^```mermaid/m)
|
|
274
274
|
};
|
|
@@ -381,12 +381,12 @@ function scanMonacoReferencedMods(md) {
|
|
|
381
381
|
const types = /* @__PURE__ */ new Set();
|
|
382
382
|
const deps = /* @__PURE__ */ new Set();
|
|
383
383
|
md.replace(
|
|
384
|
-
/^```(\w
|
|
384
|
+
/^```(\w+)\s*\{monaco([^}]*)\}\s*(\S[\s\S]*?)^```/gm,
|
|
385
385
|
(full, lang = "ts", kind, code) => {
|
|
386
386
|
lang = lang.trim();
|
|
387
387
|
const isDep = kind === "-run";
|
|
388
388
|
if (["js", "javascript", "ts", "typescript"].includes(lang)) {
|
|
389
|
-
for (const [, , specifier] of code.matchAll(/\s+from\s+(["'])([
|
|
389
|
+
for (const [, , specifier] of code.matchAll(/\s+from\s+(["'])([/.\w@-]+)\1/g)) {
|
|
390
390
|
if (specifier) {
|
|
391
391
|
if (!"./".includes(specifier))
|
|
392
392
|
types.add(specifier);
|
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.49.
|
|
3
|
+
"version": "0.49.3",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@antfu/utils": "^0.7.8",
|
|
43
43
|
"yaml": "^2.4.2",
|
|
44
|
-
"@slidev/types": "0.49.
|
|
44
|
+
"@slidev/types": "0.49.3"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts",
|