@slidev/parser 0.49.29 → 0.50.0-beta.1
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-3LX2JHFR.mjs → chunk-B5TCG27R.mjs} +15 -2
- package/dist/core.d.mts +5 -5
- package/dist/core.mjs +1 -1
- package/dist/fs.mjs +3 -2
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// src/core.ts
|
|
2
|
-
import YAML from "yaml";
|
|
3
2
|
import { ensurePrefix } from "@antfu/utils";
|
|
3
|
+
import YAML from "yaml";
|
|
4
|
+
|
|
5
|
+
// src/config.ts
|
|
6
|
+
import { toArray, uniq as uniq2 } from "@antfu/utils";
|
|
4
7
|
|
|
5
8
|
// src/utils.ts
|
|
6
9
|
import { isNumber, range, uniq } from "@antfu/utils";
|
|
@@ -36,7 +39,6 @@ function parseAspectRatio(str) {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
// src/config.ts
|
|
39
|
-
import { toArray, uniq as uniq2 } from "@antfu/utils";
|
|
40
42
|
function getDefaultConfig() {
|
|
41
43
|
return {
|
|
42
44
|
theme: "default",
|
|
@@ -74,6 +76,7 @@ function getDefaultConfig() {
|
|
|
74
76
|
transition: null,
|
|
75
77
|
editor: true,
|
|
76
78
|
contextMenu: null,
|
|
79
|
+
overviewSnapshots: false,
|
|
77
80
|
wakeLock: true,
|
|
78
81
|
remote: false,
|
|
79
82
|
mdc: false
|
|
@@ -282,6 +285,7 @@ function parseSlide(raw, options = {}) {
|
|
|
282
285
|
let note;
|
|
283
286
|
const frontmatter = matterResult.data || {};
|
|
284
287
|
let content = matterResult.content.trim();
|
|
288
|
+
const revision = hash(raw.trim());
|
|
285
289
|
const comments = Array.from(content.matchAll(/<!--([\s\S]*?)-->/g));
|
|
286
290
|
if (comments.length) {
|
|
287
291
|
const last = comments[comments.length - 1];
|
|
@@ -305,6 +309,7 @@ function parseSlide(raw, options = {}) {
|
|
|
305
309
|
raw,
|
|
306
310
|
title,
|
|
307
311
|
level,
|
|
312
|
+
revision,
|
|
308
313
|
content,
|
|
309
314
|
frontmatter,
|
|
310
315
|
frontmatterStyle: matterResult.type,
|
|
@@ -460,6 +465,14 @@ function scanMonacoReferencedMods(md) {
|
|
|
460
465
|
deps: Array.from(deps)
|
|
461
466
|
};
|
|
462
467
|
}
|
|
468
|
+
function hash(str) {
|
|
469
|
+
let hash2 = 0;
|
|
470
|
+
for (let i = 0; i < str.length; i++) {
|
|
471
|
+
hash2 = (hash2 << 5) - hash2 + str.charCodeAt(i);
|
|
472
|
+
hash2 |= 0;
|
|
473
|
+
}
|
|
474
|
+
return hash2.toString(36).slice(0, 12);
|
|
475
|
+
}
|
|
463
476
|
|
|
464
477
|
export {
|
|
465
478
|
parseRangeString,
|
package/dist/core.d.mts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { SlidevConfig, SlidevThemeMeta, FontOptions, ResolvedFontOptions, SlidevMarkdown, SourceSlideInfo, SlidevDetectedFeatures, SlidevPreparserExtension } from '@slidev/types';
|
|
2
2
|
|
|
3
|
+
declare function getDefaultConfig(): SlidevConfig;
|
|
4
|
+
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta, filepath?: string, verify?: boolean): SlidevConfig;
|
|
5
|
+
declare function verifyConfig(config: SlidevConfig, themeMeta?: SlidevThemeMeta, warn?: (v: string) => void): void;
|
|
6
|
+
declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
7
|
+
|
|
3
8
|
/**
|
|
4
9
|
* 1,3-5,8 => [1, 3, 4, 5, 8]
|
|
5
10
|
*/
|
|
@@ -9,11 +14,6 @@ declare function parseRangeString(total: number, rangeStr?: string): number[];
|
|
|
9
14
|
*/
|
|
10
15
|
declare function parseAspectRatio(str: string | number): number;
|
|
11
16
|
|
|
12
|
-
declare function getDefaultConfig(): SlidevConfig;
|
|
13
|
-
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta, filepath?: string, verify?: boolean): SlidevConfig;
|
|
14
|
-
declare function verifyConfig(config: SlidevConfig, themeMeta?: SlidevThemeMeta, warn?: (v: string) => void): void;
|
|
15
|
-
declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
16
|
-
|
|
17
17
|
interface SlidevParserOptions {
|
|
18
18
|
noParseYAML?: boolean;
|
|
19
19
|
preserveCR?: boolean;
|
package/dist/core.mjs
CHANGED
package/dist/fs.mjs
CHANGED
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
stringify,
|
|
14
14
|
stringifySlide,
|
|
15
15
|
verifyConfig
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-B5TCG27R.mjs";
|
|
17
17
|
|
|
18
18
|
// src/fs.ts
|
|
19
19
|
import fs from "node:fs";
|
|
20
20
|
import { dirname, resolve } from "node:path";
|
|
21
|
-
import YAML from "yaml";
|
|
22
21
|
import { slash } from "@antfu/utils";
|
|
22
|
+
import YAML from "yaml";
|
|
23
23
|
var preparserExtensionLoader = null;
|
|
24
24
|
function injectPreparserExtensionLoader(fn) {
|
|
25
25
|
preparserExtensionLoader = fn;
|
|
@@ -94,6 +94,7 @@ async function load(userRoot, filepath, loadedSource = {}, mode) {
|
|
|
94
94
|
slides.push({
|
|
95
95
|
frontmatter: { ...slide.frontmatter, ...frontmatterOverride },
|
|
96
96
|
content: slide.content,
|
|
97
|
+
revision: slide.revision,
|
|
97
98
|
frontmatterRaw: slide.frontmatterRaw,
|
|
98
99
|
note: slide.note,
|
|
99
100
|
title: slide.title,
|
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.50.0-beta.1",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "antfu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@antfu/utils": "^0.7.10",
|
|
40
|
-
"yaml": "^2.5.
|
|
41
|
-
"@slidev/types": "0.
|
|
40
|
+
"yaml": "^2.5.1",
|
|
41
|
+
"@slidev/types": "0.50.0-beta.1"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "rimraf dist && tsup src/index.ts src/core.ts src/fs.ts",
|