@slidev/parser 52.19.0 → 52.19.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/core.d.mts +15 -15
- package/dist/core.mjs +5 -3
- package/dist/fs.d.mts +7 -7
- package/package.json +3 -3
package/dist/core.d.mts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { a as TimesplitOutput, i as TimesplitInput, n as parseRangeString, o as parseTimesplits, r as parseTimeString, t as parseAspectRatio } from "./utils-DpcPp-I0.mjs";
|
|
2
2
|
import { FontOptions, ResolvedFontOptions, SlidevConfig, SlidevDetectedFeatures, SlidevMarkdown, SlidevPreparserExtension, SlidevThemeMeta, SourceSlideInfo } from "@slidev/types";
|
|
3
3
|
//#region src/config.d.ts
|
|
4
|
-
declare function getDefaultConfig(): SlidevConfig;
|
|
5
|
-
declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta, filepath?: string, verify?: boolean): SlidevConfig;
|
|
6
|
-
declare function verifyConfig(config: SlidevConfig, themeMeta?: SlidevThemeMeta, warn?: (v: string) => void): void;
|
|
7
|
-
declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
4
|
+
export declare function getDefaultConfig(): SlidevConfig;
|
|
5
|
+
export declare function resolveConfig(headmatter: any, themeMeta?: SlidevThemeMeta, filepath?: string, verify?: boolean): SlidevConfig;
|
|
6
|
+
export declare function verifyConfig(config: SlidevConfig, themeMeta?: SlidevThemeMeta, warn?: (v: string) => void): void;
|
|
7
|
+
export declare function resolveFonts(fonts?: FontOptions): ResolvedFontOptions;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/core.d.ts
|
|
10
|
-
interface SlidevParserOptions {
|
|
10
|
+
export interface SlidevParserOptions {
|
|
11
11
|
noParseYAML?: boolean;
|
|
12
12
|
preserveCR?: boolean;
|
|
13
13
|
}
|
|
14
|
-
declare function stringify(data: SlidevMarkdown): string;
|
|
15
|
-
declare function stringifySlide(data: SourceSlideInfo, idx?: number): string;
|
|
16
|
-
declare function prettifySlide(data: SourceSlideInfo): SourceSlideInfo;
|
|
17
|
-
declare function prettify(data: SlidevMarkdown): SlidevMarkdown;
|
|
14
|
+
export declare function stringify(data: SlidevMarkdown): string;
|
|
15
|
+
export declare function stringifySlide(data: SourceSlideInfo, idx?: number): string;
|
|
16
|
+
export declare function prettifySlide(data: SourceSlideInfo): SourceSlideInfo;
|
|
17
|
+
export declare function prettify(data: SlidevMarkdown): SlidevMarkdown;
|
|
18
18
|
/**
|
|
19
19
|
* Extract image URLs from slide content and frontmatter.
|
|
20
20
|
* Strips code blocks first to avoid false positives.
|
|
21
21
|
*/
|
|
22
|
-
declare function extractImagesUsage(content: string, frontmatter: Record<string, any>): string[];
|
|
23
|
-
declare function detectFeatures(code: string): SlidevDetectedFeatures;
|
|
24
|
-
declare function parseSlide(raw: string, options?: SlidevParserOptions): Omit<SourceSlideInfo, 'filepath' | 'index' | 'start' | 'contentStart' | 'end'>;
|
|
25
|
-
declare function parse(markdown: string, filepath: string, extensions?: SlidevPreparserExtension[], options?: SlidevParserOptions): Promise<SlidevMarkdown>;
|
|
26
|
-
declare function parseSync(markdown: string, filepath: string, options?: SlidevParserOptions): SlidevMarkdown;
|
|
22
|
+
export declare function extractImagesUsage(content: string, frontmatter: Record<string, any>): string[];
|
|
23
|
+
export declare function detectFeatures(code: string): SlidevDetectedFeatures;
|
|
24
|
+
export declare function parseSlide(raw: string, options?: SlidevParserOptions): Omit<SourceSlideInfo, 'filepath' | 'index' | 'start' | 'contentStart' | 'end'>;
|
|
25
|
+
export declare function parse(markdown: string, filepath: string, extensions?: SlidevPreparserExtension[], options?: SlidevParserOptions): Promise<SlidevMarkdown>;
|
|
26
|
+
export declare function parseSync(markdown: string, filepath: string, options?: SlidevParserOptions): SlidevMarkdown;
|
|
27
27
|
//#endregion
|
|
28
|
-
export {
|
|
28
|
+
export { TimesplitInput, TimesplitOutput, parseAspectRatio, parseRangeString, parseTimeString, parseTimesplits };
|
package/dist/core.mjs
CHANGED
|
@@ -273,9 +273,11 @@ function extractImagesUsage(content, frontmatter) {
|
|
|
273
273
|
"background"
|
|
274
274
|
]) {
|
|
275
275
|
const val = frontmatter[key];
|
|
276
|
-
if (typeof val === "string" && val && !val.startsWith("data:"))
|
|
277
|
-
if (
|
|
278
|
-
|
|
276
|
+
if (typeof val === "string" && val && !val.startsWith("data:")) {
|
|
277
|
+
if (key === "background") {
|
|
278
|
+
if (IMAGE_EXTENSIONS.test(val) || val.startsWith("/") || val.startsWith("http")) images.add(val);
|
|
279
|
+
} else images.add(val);
|
|
280
|
+
}
|
|
279
281
|
}
|
|
280
282
|
const stripped = content.replace(/^```[\s\S]+?^```/gm, "");
|
|
281
283
|
for (const [, url] of stripped.matchAll(/!\[[^\]]*\]\(([^)]+)\)/g)) if (url && !url.startsWith("data:")) images.add(url.trim());
|
package/dist/fs.d.mts
CHANGED
|
@@ -7,9 +7,9 @@ import { PreparserExtensionLoader, SlidevData, SlidevMarkdown } from "@slidev/ty
|
|
|
7
7
|
* Inlined here (rather than imported from the `slidev` package) because
|
|
8
8
|
* `@slidev/parser` must stay independent of `@slidev/slidev`.
|
|
9
9
|
*/
|
|
10
|
-
declare function isPathInsideRoots(filePath: string, roots: string[]): boolean;
|
|
11
|
-
declare function injectPreparserExtensionLoader(fn: PreparserExtensionLoader): void;
|
|
12
|
-
interface LoadRootsInfo {
|
|
10
|
+
export declare function isPathInsideRoots(filePath: string, roots: string[]): boolean;
|
|
11
|
+
export declare function injectPreparserExtensionLoader(fn: PreparserExtensionLoader): void;
|
|
12
|
+
export interface LoadRootsInfo {
|
|
13
13
|
roots: string[];
|
|
14
14
|
userRoot: string;
|
|
15
15
|
/**
|
|
@@ -23,8 +23,8 @@ interface LoadRootsInfo {
|
|
|
23
23
|
* Slidev data without config and themeMeta,
|
|
24
24
|
* because config and themeMeta depends on the theme to be loaded.
|
|
25
25
|
*/
|
|
26
|
-
type LoadedSlidevData = Omit<SlidevData, 'config' | 'themeMeta'>;
|
|
27
|
-
declare function load(options: LoadRootsInfo, filepath: string, sources?: Record<string, string> | ((path: string) => Promise<string>), mode?: string): Promise<LoadedSlidevData>;
|
|
28
|
-
declare function save(markdown: SlidevMarkdown): Promise<string>;
|
|
26
|
+
export type LoadedSlidevData = Omit<SlidevData, 'config' | 'themeMeta'>;
|
|
27
|
+
export declare function load(options: LoadRootsInfo, filepath: string, sources?: Record<string, string> | ((path: string) => Promise<string>), mode?: string): Promise<LoadedSlidevData>;
|
|
28
|
+
export declare function save(markdown: SlidevMarkdown): Promise<string>;
|
|
29
29
|
//#endregion
|
|
30
|
-
export {
|
|
30
|
+
export { SlidevParserOptions, TimesplitInput, TimesplitOutput, detectFeatures, extractImagesUsage, getDefaultConfig, parse, parseAspectRatio, parseRangeString, parseSlide, parseSync, parseTimeString, parseTimesplits, prettify, prettifySlide, resolveConfig, resolveFonts, stringify, stringifySlide, verifyConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/parser",
|
|
3
|
-
"version": "52.19.
|
|
3
|
+
"version": "52.19.2",
|
|
4
4
|
"description": "Markdown parser for Slidev",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@antfu/utils": "^9.3.0",
|
|
33
|
+
"@slidev/types": "52.19.2",
|
|
33
34
|
"pathe": "^2.0.3",
|
|
34
|
-
"yaml": "^2.9.
|
|
35
|
-
"@slidev/types": "52.19.0"
|
|
35
|
+
"yaml": "^2.9.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"tsdown-stale-guard": "^0.1.3"
|