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