@slidev/parser 0.35.6 → 0.36.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-X4HJK4PF.mjs → chunk-HAH3WBCS.mjs} +6 -5
- package/dist/{chunk-TGY6TTGP.js → chunk-POYSXW27.js} +6 -5
- package/dist/core.d.ts +1 -1
- package/dist/core.js +2 -2
- package/dist/core.mjs +1 -1
- package/dist/fs.js +7 -7
- package/dist/fs.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -156,7 +156,7 @@ function parseAspectRatio(str) {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// src/config.ts
|
|
159
|
-
function resolveConfig(headmatter, themeMeta = {}, verify = false) {
|
|
159
|
+
function resolveConfig(headmatter, themeMeta = {}, filepath, verify = false) {
|
|
160
160
|
var _a, _b;
|
|
161
161
|
const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
|
|
162
162
|
const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
|
|
@@ -196,7 +196,7 @@ function resolveConfig(headmatter, themeMeta = {}, verify = false) {
|
|
|
196
196
|
...(_b = headmatter.config) == null ? void 0 : _b.fonts,
|
|
197
197
|
...headmatter == null ? void 0 : headmatter.fonts
|
|
198
198
|
}),
|
|
199
|
-
drawings: resolveDrawings(headmatter.drawings)
|
|
199
|
+
drawings: resolveDrawings(headmatter.drawings, filepath)
|
|
200
200
|
};
|
|
201
201
|
if (config.colorSchema !== "dark" && config.colorSchema !== "light")
|
|
202
202
|
config.colorSchema = "auto";
|
|
@@ -288,14 +288,15 @@ function resolveFonts(fonts = {}) {
|
|
|
288
288
|
weights
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
function resolveDrawings(options = {}) {
|
|
291
|
+
function resolveDrawings(options = {}, filepath) {
|
|
292
|
+
var _a;
|
|
292
293
|
const {
|
|
293
294
|
enabled = true,
|
|
294
295
|
persist = false,
|
|
295
296
|
presenterOnly = false,
|
|
296
297
|
syncAll = true
|
|
297
298
|
} = options;
|
|
298
|
-
const persistPath = typeof persist === "string" ? persist : persist ?
|
|
299
|
+
const persistPath = typeof persist === "string" ? persist : persist ? `.slidev/drawings${filepath ? `/${(_a = filepath.match(/([^\\\/]+?)(\.\w+)?$/)) == null ? void 0 : _a[1]}` : ""}` : false;
|
|
299
300
|
return {
|
|
300
301
|
enabled,
|
|
301
302
|
persist: persistPath,
|
|
@@ -439,7 +440,7 @@ function parse(markdown, filepath, themeMeta) {
|
|
|
439
440
|
slice(lines.length);
|
|
440
441
|
const headmatter = ((_a = slides[0]) == null ? void 0 : _a.frontmatter) || {};
|
|
441
442
|
headmatter.title = headmatter.title || ((_b = slides[0]) == null ? void 0 : _b.title);
|
|
442
|
-
const config = resolveConfig(headmatter, themeMeta);
|
|
443
|
+
const config = resolveConfig(headmatter, themeMeta, filepath);
|
|
443
444
|
const features = detectFeatures(markdown);
|
|
444
445
|
return {
|
|
445
446
|
raw: markdown,
|
|
@@ -156,7 +156,7 @@ function parseAspectRatio(str) {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// src/config.ts
|
|
159
|
-
function resolveConfig(headmatter, themeMeta = {}, verify = false) {
|
|
159
|
+
function resolveConfig(headmatter, themeMeta = {}, filepath, verify = false) {
|
|
160
160
|
var _a, _b;
|
|
161
161
|
const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
|
|
162
162
|
const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
|
|
@@ -196,7 +196,7 @@ function resolveConfig(headmatter, themeMeta = {}, verify = false) {
|
|
|
196
196
|
...(_b = headmatter.config) == null ? void 0 : _b.fonts,
|
|
197
197
|
...headmatter == null ? void 0 : headmatter.fonts
|
|
198
198
|
}),
|
|
199
|
-
drawings: resolveDrawings(headmatter.drawings)
|
|
199
|
+
drawings: resolveDrawings(headmatter.drawings, filepath)
|
|
200
200
|
};
|
|
201
201
|
if (config.colorSchema !== "dark" && config.colorSchema !== "light")
|
|
202
202
|
config.colorSchema = "auto";
|
|
@@ -288,14 +288,15 @@ function resolveFonts(fonts = {}) {
|
|
|
288
288
|
weights
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
function resolveDrawings(options = {}) {
|
|
291
|
+
function resolveDrawings(options = {}, filepath) {
|
|
292
|
+
var _a;
|
|
292
293
|
const {
|
|
293
294
|
enabled = true,
|
|
294
295
|
persist = false,
|
|
295
296
|
presenterOnly = false,
|
|
296
297
|
syncAll = true
|
|
297
298
|
} = options;
|
|
298
|
-
const persistPath = typeof persist === "string" ? persist : persist ?
|
|
299
|
+
const persistPath = typeof persist === "string" ? persist : persist ? `.slidev/drawings${filepath ? `/${(_a = filepath.match(/([^\\\/]+?)(\.\w+)?$/)) == null ? void 0 : _a[1]}` : ""}` : false;
|
|
299
300
|
return {
|
|
300
301
|
enabled,
|
|
301
302
|
persist: persistPath,
|
|
@@ -439,7 +440,7 @@ function parse(markdown, filepath, themeMeta) {
|
|
|
439
440
|
slice(lines.length);
|
|
440
441
|
const headmatter = ((_a = slides[0]) == null ? void 0 : _a.frontmatter) || {};
|
|
441
442
|
headmatter.title = headmatter.title || ((_b = slides[0]) == null ? void 0 : _b.title);
|
|
442
|
-
const config = resolveConfig(headmatter, themeMeta);
|
|
443
|
+
const config = resolveConfig(headmatter, themeMeta, filepath);
|
|
443
444
|
const features = detectFeatures(markdown);
|
|
444
445
|
return {
|
|
445
446
|
raw: markdown,
|
package/dist/core.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare function parseRangeString(total: number, rangeStr?: string): number[];
|
|
|
9
9
|
*/
|
|
10
10
|
declare function parseAspectRatio(str: string | number): number;
|
|
11
11
|
|
|
12
|
-
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta, verify?: boolean): SlidevConfig;
|
|
12
|
+
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta, filepath?: string, verify?: boolean): SlidevConfig;
|
|
13
13
|
declare function verifyConfig(config: SlidevConfig, themeMeta?: SlidevThemeMeta, warn?: (v: string) => void): void;
|
|
14
14
|
declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
15
15
|
|
package/dist/core.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkPOYSXW27js = require('./chunk-POYSXW27.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -31,4 +31,4 @@ var _chunkTGY6TTGPjs = require('./chunk-TGY6TTGP.js');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
exports.detectFeatures =
|
|
34
|
+
exports.detectFeatures = _chunkPOYSXW27js.detectFeatures; exports.filterDisabled = _chunkPOYSXW27js.filterDisabled; exports.mergeFeatureFlags = _chunkPOYSXW27js.mergeFeatureFlags; exports.parse = _chunkPOYSXW27js.parse; exports.parseAspectRatio = _chunkPOYSXW27js.parseAspectRatio; exports.parseRangeString = _chunkPOYSXW27js.parseRangeString; exports.parseSlide = _chunkPOYSXW27js.parseSlide; exports.prettify = _chunkPOYSXW27js.prettify; exports.prettifySlide = _chunkPOYSXW27js.prettifySlide; exports.resolveConfig = _chunkPOYSXW27js.resolveConfig; exports.resolveFonts = _chunkPOYSXW27js.resolveFonts; exports.scanMonacoModules = _chunkPOYSXW27js.scanMonacoModules; exports.stringify = _chunkPOYSXW27js.stringify; exports.stringifySlide = _chunkPOYSXW27js.stringifySlide; exports.verifyConfig = _chunkPOYSXW27js.verifyConfig;
|
package/dist/core.mjs
CHANGED
package/dist/fs.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkPOYSXW27js = require('./chunk-POYSXW27.js');
|
|
18
18
|
|
|
19
19
|
// src/fs.ts
|
|
20
20
|
var _fs = require('fs');
|
|
@@ -22,7 +22,7 @@ var _path = require('path');
|
|
|
22
22
|
async function load(filepath, themeMeta, content) {
|
|
23
23
|
const dir = _path.dirname.call(void 0, filepath);
|
|
24
24
|
const markdown = content != null ? content : await _fs.promises.readFile(filepath, "utf-8");
|
|
25
|
-
const data =
|
|
25
|
+
const data = _chunkPOYSXW27js.parse.call(void 0, markdown, filepath, themeMeta);
|
|
26
26
|
const entries = /* @__PURE__ */ new Set([
|
|
27
27
|
filepath
|
|
28
28
|
]);
|
|
@@ -36,7 +36,7 @@ async function load(filepath, themeMeta, content) {
|
|
|
36
36
|
const srcExpression = baseSlide.frontmatter.src;
|
|
37
37
|
const path = _path.resolve.call(void 0, dir, srcExpression);
|
|
38
38
|
const raw = await _fs.promises.readFile(path, "utf-8");
|
|
39
|
-
const subSlides =
|
|
39
|
+
const subSlides = _chunkPOYSXW27js.parse.call(void 0, raw, path, themeMeta);
|
|
40
40
|
for (const [offset, subSlide] of subSlides.slides.entries()) {
|
|
41
41
|
const slide = { ...baseSlide };
|
|
42
42
|
slide.source = {
|
|
@@ -57,7 +57,7 @@ async function load(filepath, themeMeta, content) {
|
|
|
57
57
|
...baseSlideFrontMatterWithoutSrc,
|
|
58
58
|
srcSequence: `${baseSlide.frontmatter.srcSequence ? `${baseSlide.frontmatter.srcSequence},` : ""}${srcExpression}`
|
|
59
59
|
};
|
|
60
|
-
data.features =
|
|
60
|
+
data.features = _chunkPOYSXW27js.mergeFeatureFlags.call(void 0, data.features, _chunkPOYSXW27js.detectFeatures.call(void 0, raw));
|
|
61
61
|
entries.add(path);
|
|
62
62
|
data.slides.splice(iSlide + offset, 0, slide);
|
|
63
63
|
}
|
|
@@ -69,10 +69,10 @@ async function load(filepath, themeMeta, content) {
|
|
|
69
69
|
}
|
|
70
70
|
async function save(data, filepath) {
|
|
71
71
|
filepath = filepath || data.filepath;
|
|
72
|
-
await _fs.promises.writeFile(filepath,
|
|
72
|
+
await _fs.promises.writeFile(filepath, _chunkPOYSXW27js.stringify.call(void 0, data), "utf-8");
|
|
73
73
|
}
|
|
74
74
|
async function saveExternalSlide(slide) {
|
|
75
|
-
await _fs.promises.writeFile(slide.filepath,
|
|
75
|
+
await _fs.promises.writeFile(slide.filepath, _chunkPOYSXW27js.stringifySlide.call(void 0, slide), "utf-8");
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
|
|
@@ -93,4 +93,4 @@ async function saveExternalSlide(slide) {
|
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
|
|
96
|
-
exports.detectFeatures =
|
|
96
|
+
exports.detectFeatures = _chunkPOYSXW27js.detectFeatures; exports.filterDisabled = _chunkPOYSXW27js.filterDisabled; exports.load = load; exports.mergeFeatureFlags = _chunkPOYSXW27js.mergeFeatureFlags; exports.parse = _chunkPOYSXW27js.parse; exports.parseAspectRatio = _chunkPOYSXW27js.parseAspectRatio; exports.parseRangeString = _chunkPOYSXW27js.parseRangeString; exports.parseSlide = _chunkPOYSXW27js.parseSlide; exports.prettify = _chunkPOYSXW27js.prettify; exports.prettifySlide = _chunkPOYSXW27js.prettifySlide; exports.resolveConfig = _chunkPOYSXW27js.resolveConfig; exports.resolveFonts = _chunkPOYSXW27js.resolveFonts; exports.save = save; exports.saveExternalSlide = saveExternalSlide; exports.scanMonacoModules = _chunkPOYSXW27js.scanMonacoModules; exports.stringify = _chunkPOYSXW27js.stringify; exports.stringifySlide = _chunkPOYSXW27js.stringifySlide; exports.verifyConfig = _chunkPOYSXW27js.verifyConfig;
|
package/dist/fs.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkPOYSXW27js = require('./chunk-POYSXW27.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -31,4 +31,4 @@ var _chunkTGY6TTGPjs = require('./chunk-TGY6TTGP.js');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
exports.detectFeatures =
|
|
34
|
+
exports.detectFeatures = _chunkPOYSXW27js.detectFeatures; exports.filterDisabled = _chunkPOYSXW27js.filterDisabled; exports.mergeFeatureFlags = _chunkPOYSXW27js.mergeFeatureFlags; exports.parse = _chunkPOYSXW27js.parse; exports.parseAspectRatio = _chunkPOYSXW27js.parseAspectRatio; exports.parseRangeString = _chunkPOYSXW27js.parseRangeString; exports.parseSlide = _chunkPOYSXW27js.parseSlide; exports.prettify = _chunkPOYSXW27js.prettify; exports.prettifySlide = _chunkPOYSXW27js.prettifySlide; exports.resolveConfig = _chunkPOYSXW27js.resolveConfig; exports.resolveFonts = _chunkPOYSXW27js.resolveFonts; exports.scanMonacoModules = _chunkPOYSXW27js.scanMonacoModules; exports.stringify = _chunkPOYSXW27js.stringify; exports.stringifySlide = _chunkPOYSXW27js.stringifySlide; exports.verifyConfig = _chunkPOYSXW27js.verifyConfig;
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.2",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=14.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@slidev/types": "0.
|
|
42
|
+
"@slidev/types": "0.36.2",
|
|
43
43
|
"js-yaml": "^4.1.0"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|