@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 CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  ## Documentation
7
7
 
8
- https://v2.vuepress.vuejs.org
8
+ https://vuepress.vuejs.org
9
9
 
10
10
  ## License
11
11
 
package/dist/index.d.ts CHANGED
@@ -1,132 +1,129 @@
1
- import { SfcPluginOptions } from '@mdit-vue/plugin-sfc';
2
- export { MarkdownSfcBlocks, SfcPluginOptions, sfcPlugin } from '@mdit-vue/plugin-sfc';
3
- import { MarkdownItEnv } from '@mdit-vue/types';
4
- import { PageHeader, PageFrontmatter } from '@vuepress/shared';
5
- import MarkdownIt, { PluginWithOptions } from 'markdown-it';
6
- import { FrontmatterPluginOptions } from '@mdit-vue/plugin-frontmatter';
7
- export { FrontmatterPluginOptions, frontmatterPlugin } from '@mdit-vue/plugin-frontmatter';
8
- import { HeadersPluginOptions } from '@mdit-vue/plugin-headers';
9
- export { HeadersPluginOptions, headersPlugin } from '@mdit-vue/plugin-headers';
10
- import { TocPluginOptions } from '@mdit-vue/plugin-toc';
11
- export { TocPluginOptions, tocPlugin } from '@mdit-vue/plugin-toc';
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
- * Whether to prepend base to absolute path
24
- */
25
- absolutePathPrependBase?: boolean;
26
- /**
27
- * Prefix to add to relative assets links
28
- */
29
- relativePathPrefix?: string;
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
- interface CodePluginOptions {
37
- /**
38
- * Enable highlight lines or not
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
- * A function to handle the import path
81
- */
82
- handleImportPath?: (str: string) => string;
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
- * Tag for internal links
89
- *
90
- * @default 'VPLink'
91
- */
92
- internalTag?: 'a' | 'VPLink' | 'RouterLink';
93
- /**
94
- * Additional attributes for external links
95
- *
96
- * @default
97
- * ```js
98
- * ({
99
- * target: '_blank',
100
- * rel: 'noopener noreferrer',
101
- * })
102
- * ```
103
- */
104
- externalAttrs?: Record<string, string>;
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 them into `<VPLink>`
110
- * - external links: add extra attrs and external icon
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
- interface MarkdownOptions extends MarkdownIt.Options {
117
- anchor?: false | AnchorPluginOptions;
118
- assets?: false | AssetsPluginOptions;
119
- code?: false | CodePluginOptions;
120
- component?: false;
121
- emoji?: false | EmojiPluginOptions;
122
- frontmatter?: false | FrontmatterPluginOptions;
123
- headers?: false | HeadersPluginOptions;
124
- title?: false;
125
- importCode?: false | ImportCodePluginOptions;
126
- links?: false | LinksPluginOptions;
127
- sfc?: false | SfcPluginOptions;
128
- slugify?: MarkdownSlugifyFunction;
129
- toc?: false | TocPluginOptions;
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
- raw: string;
142
- relative: string;
143
- absolute: string;
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
- * Base / publicPath of current site
155
- */
156
- base?: string;
157
- /**
158
- * Absolute file path of the markdown file
159
- */
160
- filePath?: string | null;
161
- /**
162
- * Relative file path of the markdown file
163
- */
164
- filePathRelative?: string | null;
165
- /**
166
- * Frontmatter of the markdown file
167
- */
168
- frontmatter?: PageFrontmatter;
169
- /**
170
- * Imported file that extracted by importCodePlugin
171
- */
172
- importedFiles?: string[];
173
- /**
174
- * Links that extracted by linksPlugin
175
- */
176
- links?: MarkdownLink[];
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: ({ anchor, assets, code, component, emoji, frontmatter, headers, title, importCode, links, sfc, slugify, toc, ...markdownItOptions }?: MarkdownOptions) => Markdown;
187
-
188
- export { type AnchorPluginOptions, type AssetsPluginOptions, type CodePluginOptions, type EmojiPluginOptions, type ImportCodePluginOptions, type LinksPluginOptions, type Markdown, type MarkdownEnv, type MarkdownHeader, type MarkdownLink, type MarkdownOptions, type MarkdownSlugifyFunction, assetsPlugin, codePlugin, createMarkdown, importCodePlugin, linksPlugin };
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 };