@vuepress/markdown 2.0.0-rc.3 → 2.0.0-rc.31
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/README.md +1 -1
- package/dist/index.d.ts +139 -142
- package/dist/index.js +307 -584
- package/package.json +36 -44
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,132 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export { default as anchorPlugin } from 'markdown-it-anchor';
|
|
14
|
-
import { Options } from 'markdown-it-emoji';
|
|
15
|
-
export { full as emojiPlugin } from 'markdown-it-emoji';
|
|
16
|
-
export { ComponentPluginOptions, componentPlugin } from '@mdit-vue/plugin-component';
|
|
17
|
-
export { titlePlugin } from '@mdit-vue/plugin-title';
|
|
18
|
-
|
|
1
|
+
import MarkdownIt, { Options, PluginWithOptions } from "markdown-it";
|
|
2
|
+
import { ComponentPluginOptions, componentPlugin } from "@mdit-vue/plugin-component";
|
|
3
|
+
import { FrontmatterPluginOptions, frontmatterPlugin } from "@mdit-vue/plugin-frontmatter";
|
|
4
|
+
import { HeadersPluginOptions, headersPlugin } from "@mdit-vue/plugin-headers";
|
|
5
|
+
import { MarkdownSfcBlocks, SfcPluginOptions, sfcPlugin } from "@mdit-vue/plugin-sfc";
|
|
6
|
+
import { titlePlugin } from "@mdit-vue/plugin-title";
|
|
7
|
+
import { TocPluginOptions, tocPlugin } from "@mdit-vue/plugin-toc";
|
|
8
|
+
import anchorPlugin from "markdown-it-anchor";
|
|
9
|
+
import { Options as Options$1, full as emojiPlugin } from "markdown-it-emoji";
|
|
10
|
+
import { PageFrontmatter, PageHeader } from "@vuepress/shared";
|
|
11
|
+
import { MarkdownItEnv } from "@mdit-vue/types";
|
|
12
|
+
//#region src/plugins/anchorPlugin.d.ts
|
|
19
13
|
type AnchorPluginOptions = anchorPlugin.AnchorOptions;
|
|
20
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/plugins/assetsPlugin/assetsPlugin.d.ts
|
|
21
16
|
interface AssetsPluginOptions {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Whether to prepend base to absolute path
|
|
19
|
+
*/
|
|
20
|
+
absolutePathPrependBase?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Use aliases for non-strict relative paths.
|
|
23
|
+
*
|
|
24
|
+
* This is a path that does not start
|
|
25
|
+
* with `./` or `../` or `/` or `<protocol header>`:
|
|
26
|
+
* `<img src="path1/path2.png" />`
|
|
27
|
+
*
|
|
28
|
+
* - If the option is `true`. `path1` is regarded as an alias.
|
|
29
|
+
* - If the option is `false`. It is regarded as a relative path.
|
|
30
|
+
* - If the option is `"@-prefix"`.
|
|
31
|
+
* If the path starts with `@`, `path1` is regarded as an alias;
|
|
32
|
+
* Otherwise, it is regarded as a relative path.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
aliasSupport?: boolean | '@-prefix';
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
32
39
|
* Plugin to handle assets links
|
|
33
40
|
*/
|
|
34
41
|
declare const assetsPlugin: PluginWithOptions<AssetsPluginOptions>;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
highlightLines?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Enable line numbers or not
|
|
43
|
-
*
|
|
44
|
-
* - A `boolean` value is to enable line numbers or not.
|
|
45
|
-
* - A `number` value is the minimum number of lines to enable line numbers
|
|
46
|
-
*/
|
|
47
|
-
lineNumbers?: boolean | number;
|
|
48
|
-
/**
|
|
49
|
-
* Wrap the `<pre>` tag with an extra `<div>` or not. Do not disable it unless you
|
|
50
|
-
* understand what's it for
|
|
51
|
-
*
|
|
52
|
-
* - Required for `highlightLines`
|
|
53
|
-
* - Required for `lineNumbers`
|
|
54
|
-
* - Required for title display of default theme
|
|
55
|
-
*/
|
|
56
|
-
preWrapper?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Add `v-pre` directive or not
|
|
59
|
-
*/
|
|
60
|
-
vPre?: {
|
|
61
|
-
/**
|
|
62
|
-
* Add `v-pre` directive to `<pre>` tag of code block or not
|
|
63
|
-
*/
|
|
64
|
-
block?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Add `v-pre` directive to `<code>` tag of inline code or not
|
|
67
|
-
*/
|
|
68
|
-
inline?: boolean;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Code plugin
|
|
73
|
-
*/
|
|
74
|
-
declare const codePlugin: PluginWithOptions<CodePluginOptions>;
|
|
75
|
-
|
|
76
|
-
type EmojiPluginOptions = Options;
|
|
77
|
-
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/plugins/emojiPlugin.d.ts
|
|
44
|
+
type EmojiPluginOptions = Options$1;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/plugins/importCodePlugin/importCodePlugin.d.ts
|
|
78
47
|
interface ImportCodePluginOptions {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
48
|
+
/**
|
|
49
|
+
* A function to handle the import path
|
|
50
|
+
*/
|
|
51
|
+
handleImportPath?: (str: string) => string;
|
|
83
52
|
}
|
|
84
53
|
declare const importCodePlugin: PluginWithOptions<ImportCodePluginOptions>;
|
|
85
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/plugins/linksPlugin/linksPlugin.d.ts
|
|
86
56
|
interface LinksPluginOptions {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Additional attributes for external links
|
|
59
|
+
*
|
|
60
|
+
* @default
|
|
61
|
+
* ```js
|
|
62
|
+
* ({
|
|
63
|
+
* target: '_blank',
|
|
64
|
+
* rel: 'noopener noreferrer',
|
|
65
|
+
* })
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
externalAttrs?: Record<string, string>;
|
|
69
|
+
/**
|
|
70
|
+
* Tag for internal links
|
|
71
|
+
*
|
|
72
|
+
* @default 'RouteLink'
|
|
73
|
+
*/
|
|
74
|
+
internalTag?: 'a' | 'RouteLink' | 'RouterLink';
|
|
75
|
+
/**
|
|
76
|
+
* Method to check if a link is external
|
|
77
|
+
*
|
|
78
|
+
* @default import { isLinkExternal } from '@vuepress/shared'
|
|
79
|
+
*/
|
|
80
|
+
isExternal?: (href: string, env: MarkdownEnv) => boolean;
|
|
105
81
|
}
|
|
106
82
|
/**
|
|
107
83
|
* Process links in markdown file
|
|
108
84
|
*
|
|
109
|
-
* - internal links: convert
|
|
110
|
-
* - external links: add extra attrs
|
|
85
|
+
* - internal links: convert `<a>` tag into internalTag
|
|
86
|
+
* - external links: add extra attrs
|
|
111
87
|
*/
|
|
112
88
|
declare const linksPlugin: PluginWithOptions<LinksPluginOptions>;
|
|
113
|
-
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/plugins/vPrePlugin/vPrePlugin.d.ts
|
|
91
|
+
interface VPrePluginOptions {
|
|
92
|
+
/**
|
|
93
|
+
* Add `v-pre` directive to `<pre>` tag of code block or not
|
|
94
|
+
*/
|
|
95
|
+
block?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Add `v-pre` directive to `<code>` tag of inline code or not
|
|
98
|
+
*/
|
|
99
|
+
inline?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* v-pre plugin
|
|
103
|
+
*/
|
|
104
|
+
declare const vPrePlugin: PluginWithOptions<VPrePluginOptions>;
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/types.d.ts
|
|
114
107
|
type Markdown = MarkdownIt;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
108
|
+
interface MarkdownOptions extends Options {
|
|
109
|
+
anchor?: AnchorPluginOptions | false;
|
|
110
|
+
assets?: AssetsPluginOptions | false;
|
|
111
|
+
component?: false;
|
|
112
|
+
emoji?: EmojiPluginOptions | false;
|
|
113
|
+
frontmatter?: FrontmatterPluginOptions | false;
|
|
114
|
+
headers?: HeadersPluginOptions | false;
|
|
115
|
+
title?: false;
|
|
116
|
+
importCode?: ImportCodePluginOptions | false;
|
|
117
|
+
links?: LinksPluginOptions | false;
|
|
118
|
+
sfc?: SfcPluginOptions | false;
|
|
119
|
+
slugify?: MarkdownSlugifyFunction;
|
|
120
|
+
toc?: TocPluginOptions | false;
|
|
121
|
+
vPre?: VPrePluginOptions | false;
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated This feature has been removed. Please use `@vuepress/plugin-prismjs` or `@vuepress/plugin-shiki` instead.
|
|
124
|
+
*/
|
|
125
|
+
code?: never;
|
|
130
126
|
}
|
|
131
127
|
/**
|
|
132
128
|
* Headers in markdown file
|
|
@@ -138,9 +134,9 @@ type MarkdownHeader = PageHeader;
|
|
|
138
134
|
* Used for file existence check
|
|
139
135
|
*/
|
|
140
136
|
interface MarkdownLink {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
raw: string;
|
|
138
|
+
relative: string;
|
|
139
|
+
absolute: string | null;
|
|
144
140
|
}
|
|
145
141
|
/**
|
|
146
142
|
* The `env` object to be passed to markdown-it render function
|
|
@@ -150,39 +146,40 @@ interface MarkdownLink {
|
|
|
150
146
|
* Output some resources from the markdown file
|
|
151
147
|
*/
|
|
152
148
|
interface MarkdownEnv extends MarkdownItEnv {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Base / publicPath of current site
|
|
151
|
+
*/
|
|
152
|
+
base?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Absolute file path of the markdown file
|
|
155
|
+
*/
|
|
156
|
+
filePath?: string | null;
|
|
157
|
+
/**
|
|
158
|
+
* Relative file path of the markdown file
|
|
159
|
+
*/
|
|
160
|
+
filePathRelative?: string | null;
|
|
161
|
+
/**
|
|
162
|
+
* Frontmatter of the markdown file
|
|
163
|
+
*/
|
|
164
|
+
frontmatter?: PageFrontmatter;
|
|
165
|
+
/**
|
|
166
|
+
* Imported file that extracted by importCodePlugin
|
|
167
|
+
*/
|
|
168
|
+
importedFiles?: string[];
|
|
169
|
+
/**
|
|
170
|
+
* Links that extracted by linksPlugin
|
|
171
|
+
*/
|
|
172
|
+
links?: MarkdownLink[];
|
|
177
173
|
}
|
|
178
174
|
/**
|
|
179
175
|
* Type of `slugify` function
|
|
180
176
|
*/
|
|
181
177
|
type MarkdownSlugifyFunction = (str: string) => string;
|
|
182
|
-
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/markdown.d.ts
|
|
183
180
|
/**
|
|
184
181
|
* Create vuepress customized markdown-it instance
|
|
185
182
|
*/
|
|
186
|
-
declare const createMarkdown: ({ anchor, assets, code, component, emoji, frontmatter, headers, title, importCode, links, sfc, slugify, toc, ...markdownItOptions }?: MarkdownOptions) => Markdown;
|
|
187
|
-
|
|
188
|
-
export { type AnchorPluginOptions, type AssetsPluginOptions, type
|
|
183
|
+
declare const createMarkdown: ({ anchor, assets, code, vPre, component, emoji, frontmatter, headers, title, importCode, links, sfc, slugify, toc, ...markdownItOptions }?: MarkdownOptions) => Markdown;
|
|
184
|
+
//#endregion
|
|
185
|
+
export { type AnchorPluginOptions, type AssetsPluginOptions, type ComponentPluginOptions, type EmojiPluginOptions, type FrontmatterPluginOptions, type HeadersPluginOptions, type ImportCodePluginOptions, type LinksPluginOptions, type Markdown, type MarkdownEnv, type MarkdownHeader, type MarkdownLink, type MarkdownOptions, type MarkdownSfcBlocks, type MarkdownSlugifyFunction, type SfcPluginOptions, type TocPluginOptions, type VPrePluginOptions, anchorPlugin, assetsPlugin, componentPlugin, createMarkdown, emojiPlugin, frontmatterPlugin, headersPlugin, importCodePlugin, linksPlugin, sfcPlugin, titlePlugin, tocPlugin, vPrePlugin };
|