@vuepress/markdown 2.0.0-beta.49 → 2.0.0-beta.50-pre.1

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.
Files changed (51) hide show
  1. package/dist/index.d.ts +272 -0
  2. package/dist/index.js +583 -0
  3. package/package.json +38 -16
  4. package/lib/index.d.ts +0 -3
  5. package/lib/index.js +0 -19
  6. package/lib/markdown.d.ts +0 -5
  7. package/lib/markdown.js +0 -99
  8. package/lib/plugins/anchorPlugin.d.ts +0 -3
  9. package/lib/plugins/anchorPlugin.js +0 -5
  10. package/lib/plugins/assetsPlugin/assetsPlugin.d.ts +0 -11
  11. package/lib/plugins/assetsPlugin/assetsPlugin.js +0 -41
  12. package/lib/plugins/assetsPlugin/index.d.ts +0 -2
  13. package/lib/plugins/assetsPlugin/index.js +0 -18
  14. package/lib/plugins/assetsPlugin/resolveLink.d.ts +0 -2
  15. package/lib/plugins/assetsPlugin/resolveLink.js +0 -16
  16. package/lib/plugins/codePlugin/codePlugin.d.ts +0 -40
  17. package/lib/plugins/codePlugin/codePlugin.js +0 -78
  18. package/lib/plugins/codePlugin/index.d.ts +0 -6
  19. package/lib/plugins/codePlugin/index.js +0 -22
  20. package/lib/plugins/codePlugin/languages.d.ts +0 -38
  21. package/lib/plugins/codePlugin/languages.js +0 -68
  22. package/lib/plugins/codePlugin/resolveHighlightLines.d.ts +0 -9
  23. package/lib/plugins/codePlugin/resolveHighlightLines.js +0 -28
  24. package/lib/plugins/codePlugin/resolveLanguage.d.ts +0 -5
  25. package/lib/plugins/codePlugin/resolveLanguage.js +0 -40
  26. package/lib/plugins/codePlugin/resolveLineNumbers.d.ts +0 -4
  27. package/lib/plugins/codePlugin/resolveLineNumbers.js +0 -16
  28. package/lib/plugins/codePlugin/resolveVPre.d.ts +0 -4
  29. package/lib/plugins/codePlugin/resolveVPre.js +0 -16
  30. package/lib/plugins/emojiPlugin.d.ts +0 -3
  31. package/lib/plugins/emojiPlugin.js +0 -5
  32. package/lib/plugins/importCodePlugin/createImportCodeBlockRule.d.ts +0 -3
  33. package/lib/plugins/importCodePlugin/createImportCodeBlockRule.js +0 -52
  34. package/lib/plugins/importCodePlugin/importCodePlugin.d.ts +0 -8
  35. package/lib/plugins/importCodePlugin/importCodePlugin.js +0 -26
  36. package/lib/plugins/importCodePlugin/index.d.ts +0 -4
  37. package/lib/plugins/importCodePlugin/index.js +0 -20
  38. package/lib/plugins/importCodePlugin/resolveImportCode.d.ts +0 -6
  39. package/lib/plugins/importCodePlugin/resolveImportCode.js +0 -37
  40. package/lib/plugins/importCodePlugin/types.d.ts +0 -5
  41. package/lib/plugins/importCodePlugin/types.js +0 -2
  42. package/lib/plugins/index.d.ts +0 -12
  43. package/lib/plugins/index.js +0 -28
  44. package/lib/plugins/linksPlugin/index.d.ts +0 -2
  45. package/lib/plugins/linksPlugin/index.js +0 -18
  46. package/lib/plugins/linksPlugin/linksPlugin.d.ts +0 -28
  47. package/lib/plugins/linksPlugin/linksPlugin.js +0 -98
  48. package/lib/plugins/linksPlugin/resolvePaths.d.ts +0 -7
  49. package/lib/plugins/linksPlugin/resolvePaths.js +0 -51
  50. package/lib/types.d.ts +0 -71
  51. package/lib/types.js +0 -2
@@ -0,0 +1,272 @@
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 emojiPlugin from 'markdown-it-emoji';
15
+ export { default as emojiPlugin } from 'markdown-it-emoji';
16
+ export { ComponentPluginOptions, componentPlugin } from '@mdit-vue/plugin-component';
17
+ export { titlePlugin } from '@mdit-vue/plugin-title';
18
+ import { RuleBlock } from 'markdown-it/lib/parser_block.js';
19
+
20
+ declare type AnchorPluginOptions = anchorPlugin.AnchorOptions;
21
+
22
+ interface AssetsPluginOptions {
23
+ /**
24
+ * Prefix to add to relative assets links
25
+ */
26
+ relativePathPrefix?: string;
27
+ }
28
+ /**
29
+ * Plugin to handle assets links
30
+ */
31
+ declare const assetsPlugin: PluginWithOptions<AssetsPluginOptions>;
32
+
33
+ declare const resolveLink: (link: string, relativePathPrefix: string, env: MarkdownEnv) => string;
34
+
35
+ interface CodePluginOptions {
36
+ /**
37
+ * Enable highlight lines or not
38
+ */
39
+ highlightLines?: boolean;
40
+ /**
41
+ * Enable line numbers or not
42
+ *
43
+ * - A `boolean` value is to enable line numbers or not.
44
+ * - A `number` value is the minimum number of lines to enable line numbers
45
+ */
46
+ lineNumbers?: boolean | number;
47
+ /**
48
+ * Wrap the `<pre>` tag with an extra `<div>` or not. Do not disable it unless you
49
+ * understand what's it for
50
+ *
51
+ * - Required for `highlightLines`
52
+ * - Required for `lineNumbers`
53
+ * - Required for language display of default theme
54
+ */
55
+ preWrapper?: boolean;
56
+ /**
57
+ * Add `v-pre` directive or not
58
+ */
59
+ vPre?: {
60
+ /**
61
+ * Add `v-pre` directive to `<pre>` tag of code block or not
62
+ */
63
+ block?: boolean;
64
+ /**
65
+ * Add `v-pre` directive to `<code>` tag of inline code or not
66
+ */
67
+ inline?: boolean;
68
+ };
69
+ }
70
+ /**
71
+ * Code plugin
72
+ */
73
+ declare const codePlugin: PluginWithOptions<CodePluginOptions>;
74
+
75
+ /**
76
+ * Language type for syntax highlight
77
+ */
78
+ interface HighlightLanguage {
79
+ /**
80
+ * Name of the language
81
+ *
82
+ * The name to be used for the class name,
83
+ * e.g. `class="language-typescript"`
84
+ */
85
+ name: string;
86
+ /**
87
+ * Extension of the language
88
+ *
89
+ * The file extension, which will be used for the
90
+ * class name, e.g. `class="ext-ts"`
91
+ */
92
+ ext: string;
93
+ /**
94
+ * Aliases that point to this language
95
+ *
96
+ * Do not conflict with other languages
97
+ */
98
+ aliases: string[];
99
+ }
100
+ declare const languageBash: HighlightLanguage;
101
+ declare const languageCsharp: HighlightLanguage;
102
+ declare const languageDocker: HighlightLanguage;
103
+ declare const languageFsharp: HighlightLanguage;
104
+ declare const languageJavascript: HighlightLanguage;
105
+ declare const languageKotlin: HighlightLanguage;
106
+ declare const languageMarkdown: HighlightLanguage;
107
+ declare const languagePython: HighlightLanguage;
108
+ declare const languageRuby: HighlightLanguage;
109
+ declare const languageRust: HighlightLanguage;
110
+ declare const languageStylus: HighlightLanguage;
111
+ declare const languageTypescript: HighlightLanguage;
112
+ declare const languageYaml: HighlightLanguage;
113
+
114
+ declare type HighlightLinesRange = [number, number];
115
+ /**
116
+ * Resolve highlight-lines ranges from token info
117
+ */
118
+ declare const resolveHighlightLines: (info: string) => HighlightLinesRange[] | null;
119
+ /**
120
+ * Check if a line number is in ranges
121
+ */
122
+ declare const isHighlightLine: (lineNumber: number, ranges: HighlightLinesRange[]) => boolean;
123
+
124
+ /**
125
+ * Resolve language for highlight from token info
126
+ */
127
+ declare const resolveLanguage: (info: string) => HighlightLanguage;
128
+
129
+ /**
130
+ * Resolve the `:line-numbers` / `:no-line-numbers` mark from token info
131
+ */
132
+ declare const resolveLineNumbers: (info: string) => boolean | null;
133
+
134
+ /**
135
+ * Resolve the `:v-pre` / `:no-v-pre` mark from token info
136
+ */
137
+ declare const resolveVPre: (info: string) => boolean | null;
138
+
139
+ declare type EmojiPluginOptions = emojiPlugin.Options;
140
+
141
+ interface ImportCodePluginOptions {
142
+ /**
143
+ * A function to handle the import path
144
+ */
145
+ handleImportPath?: (str: string) => string;
146
+ }
147
+ declare const importCodePlugin: PluginWithOptions<ImportCodePluginOptions>;
148
+
149
+ declare const createImportCodeBlockRule: ({ handleImportPath }: ImportCodePluginOptions) => RuleBlock;
150
+
151
+ interface ImportCodeTokenMeta {
152
+ importPath: string;
153
+ lineStart: number;
154
+ lineEnd?: number;
155
+ }
156
+
157
+ declare const resolveImportCode: ({ importPath, lineStart, lineEnd }: ImportCodeTokenMeta, { filePath }: MarkdownEnv) => {
158
+ importFilePath: string | null;
159
+ importCode: string;
160
+ };
161
+
162
+ interface LinksPluginOptions {
163
+ /**
164
+ * Tag for internal links
165
+ *
166
+ * @default 'RouterLink'
167
+ */
168
+ internalTag?: 'a' | 'RouterLink';
169
+ /**
170
+ * Additional attributes for external links
171
+ *
172
+ * @default
173
+ * ```js
174
+ * ({
175
+ * target: '_blank',
176
+ * rel: 'noopener noreferrer',
177
+ * })
178
+ * ```
179
+ */
180
+ externalAttrs?: Record<string, string>;
181
+ }
182
+ /**
183
+ * Process links in markdown file
184
+ *
185
+ * - internal links: convert them into `<RouterLink>`
186
+ * - external links: add extra attrs and external icon
187
+ */
188
+ declare const linksPlugin: PluginWithOptions<LinksPluginOptions>;
189
+
190
+ /**
191
+ * Resolve relative and absolute paths according to the `base` and `filePathRelative`
192
+ */
193
+ declare const resolvePaths: (rawPath: string, base: string, filePathRelative: string | null) => {
194
+ absolutePath: string;
195
+ relativePath: string;
196
+ };
197
+
198
+ declare type Markdown = MarkdownIt;
199
+
200
+ interface MarkdownOptions extends MarkdownIt.Options {
201
+ anchor?: false | AnchorPluginOptions;
202
+ assets?: false | AssetsPluginOptions;
203
+ code?: false | CodePluginOptions;
204
+ component?: false;
205
+ emoji?: false | EmojiPluginOptions;
206
+ frontmatter?: false | FrontmatterPluginOptions;
207
+ headers?: false | HeadersPluginOptions;
208
+ title?: false;
209
+ importCode?: false | ImportCodePluginOptions;
210
+ links?: false | LinksPluginOptions;
211
+ sfc?: false | SfcPluginOptions;
212
+ slugify?: MarkdownSlugifyFunction;
213
+ toc?: false | TocPluginOptions;
214
+ }
215
+ /**
216
+ * Headers in markdown file
217
+ */
218
+ declare type MarkdownHeader = PageHeader;
219
+ /**
220
+ * Internal links in markdown file
221
+ *
222
+ * Used for file existence check
223
+ */
224
+ interface MarkdownLink {
225
+ raw: string;
226
+ relative: string;
227
+ absolute: string;
228
+ }
229
+ /**
230
+ * The `env` object to be passed to markdown-it render function
231
+ *
232
+ * Input some meta data for markdown file parsing and rendering
233
+ *
234
+ * Output some resources from the markdown file
235
+ */
236
+ interface MarkdownEnv extends MarkdownItEnv {
237
+ /**
238
+ * Base / publicPath of current site
239
+ */
240
+ base?: string;
241
+ /**
242
+ * Absolute file path of the markdown file
243
+ */
244
+ filePath?: string | null;
245
+ /**
246
+ * Relative file path of the markdown file
247
+ */
248
+ filePathRelative?: string | null;
249
+ /**
250
+ * Frontmatter of the markdown file
251
+ */
252
+ frontmatter?: PageFrontmatter;
253
+ /**
254
+ * Imported file that extracted by importCodePlugin
255
+ */
256
+ importedFiles?: string[];
257
+ /**
258
+ * Links that extracted by linksPlugin
259
+ */
260
+ links?: MarkdownLink[];
261
+ }
262
+ /**
263
+ * Type of `slugify` function
264
+ */
265
+ declare type MarkdownSlugifyFunction = (str: string) => string;
266
+
267
+ /**
268
+ * Create vuepress customized markdown-it instance
269
+ */
270
+ declare const createMarkdown: ({ anchor, assets, code, component, emoji, frontmatter, headers, title, importCode, links, sfc, slugify, toc, ...markdownItOptions }?: MarkdownOptions) => Markdown;
271
+
272
+ export { AnchorPluginOptions, AssetsPluginOptions, CodePluginOptions, EmojiPluginOptions, HighlightLanguage, HighlightLinesRange, ImportCodePluginOptions, ImportCodeTokenMeta, LinksPluginOptions, Markdown, MarkdownEnv, MarkdownHeader, MarkdownLink, MarkdownOptions, MarkdownSlugifyFunction, assetsPlugin, codePlugin, createImportCodeBlockRule, createMarkdown, importCodePlugin, isHighlightLine, languageBash, languageCsharp, languageDocker, languageFsharp, languageJavascript, languageKotlin, languageMarkdown, languagePython, languageRuby, languageRust, languageStylus, languageTypescript, languageYaml, linksPlugin, resolveHighlightLines, resolveImportCode, resolveLanguage, resolveLineNumbers, resolveLink, resolvePaths, resolveVPre };