@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 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,128 @@
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';
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
- * Whether to prepend base to absolute path
24
- */
25
- absolutePathPrependBase?: boolean;
26
- /**
27
- * Prefix to add to relative assets links
28
- */
29
- relativePathPrefix?: string;
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
- 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
-
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
- * A function to handle the import path
81
- */
82
- handleImportPath?: (str: string) => string;
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
- * 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>;
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 them into `<VPLink>`
110
- * - external links: add extra attrs and external icon
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
- 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;
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
- raw: string;
142
- relative: string;
143
- absolute: string;
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
- * 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[];
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 CodePluginOptions, type EmojiPluginOptions, type ImportCodePluginOptions, type LinksPluginOptions, type Markdown, type MarkdownEnv, type MarkdownHeader, type MarkdownLink, type MarkdownOptions, type MarkdownSlugifyFunction, assetsPlugin, codePlugin, createMarkdown, importCodePlugin, linksPlugin };
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 };