@vuepress/markdown 2.0.0-beta.9 → 2.0.0-rc.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 (74) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +12 -0
  3. package/dist/index.d.ts +188 -0
  4. package/dist/index.js +599 -0
  5. package/package.json +50 -19
  6. package/CHANGELOG.md +0 -247
  7. package/lib/index.d.ts +0 -4
  8. package/lib/index.js +0 -16
  9. package/lib/markdown.d.ts +0 -5
  10. package/lib/markdown.js +0 -77
  11. package/lib/plugins/anchorPlugin.d.ts +0 -62
  12. package/lib/plugins/anchorPlugin.js +0 -5
  13. package/lib/plugins/assetsPlugin.d.ts +0 -11
  14. package/lib/plugins/assetsPlugin.js +0 -24
  15. package/lib/plugins/codePlugin/codePlugin.d.ts +0 -28
  16. package/lib/plugins/codePlugin/codePlugin.js +0 -73
  17. package/lib/plugins/codePlugin/index.d.ts +0 -6
  18. package/lib/plugins/codePlugin/index.js +0 -18
  19. package/lib/plugins/codePlugin/languages.d.ts +0 -38
  20. package/lib/plugins/codePlugin/languages.js +0 -68
  21. package/lib/plugins/codePlugin/resolveHighlightLines.d.ts +0 -9
  22. package/lib/plugins/codePlugin/resolveHighlightLines.js +0 -28
  23. package/lib/plugins/codePlugin/resolveLanguage.d.ts +0 -5
  24. package/lib/plugins/codePlugin/resolveLanguage.js +0 -41
  25. package/lib/plugins/codePlugin/resolveLineNumbers.d.ts +0 -4
  26. package/lib/plugins/codePlugin/resolveLineNumbers.js +0 -16
  27. package/lib/plugins/codePlugin/resolveVPre.d.ts +0 -4
  28. package/lib/plugins/codePlugin/resolveVPre.js +0 -16
  29. package/lib/plugins/customComponentPlugin/customComponentPlugin.d.ts +0 -6
  30. package/lib/plugins/customComponentPlugin/customComponentPlugin.js +0 -18
  31. package/lib/plugins/customComponentPlugin/htmlBlockRule.d.ts +0 -2
  32. package/lib/plugins/customComponentPlugin/htmlBlockRule.js +0 -90
  33. package/lib/plugins/customComponentPlugin/htmlInlineRule.d.ts +0 -2
  34. package/lib/plugins/customComponentPlugin/htmlInlineRule.js +0 -40
  35. package/lib/plugins/customComponentPlugin/htmlRe.d.ts +0 -2
  36. package/lib/plugins/customComponentPlugin/htmlRe.js +0 -33
  37. package/lib/plugins/customComponentPlugin/index.d.ts +0 -4
  38. package/lib/plugins/customComponentPlugin/index.js +0 -16
  39. package/lib/plugins/customComponentPlugin/inlineTags.d.ts +0 -18
  40. package/lib/plugins/customComponentPlugin/inlineTags.js +0 -78
  41. package/lib/plugins/customComponentPlugin/vueReservedTags.d.ts +0 -6
  42. package/lib/plugins/customComponentPlugin/vueReservedTags.js +0 -17
  43. package/lib/plugins/emojiPlugin.d.ts +0 -25
  44. package/lib/plugins/emojiPlugin.js +0 -5
  45. package/lib/plugins/extractHeadersPlugin.d.ts +0 -27
  46. package/lib/plugins/extractHeadersPlugin.js +0 -32
  47. package/lib/plugins/hoistTagsPlugin.d.ts +0 -12
  48. package/lib/plugins/hoistTagsPlugin.js +0 -26
  49. package/lib/plugins/index.d.ts +0 -9
  50. package/lib/plugins/index.js +0 -21
  51. package/lib/plugins/linksPlugin/index.d.ts +0 -2
  52. package/lib/plugins/linksPlugin/index.js +0 -14
  53. package/lib/plugins/linksPlugin/linksPlugin.d.ts +0 -12
  54. package/lib/plugins/linksPlugin/linksPlugin.js +0 -108
  55. package/lib/plugins/linksPlugin/resolvePaths.d.ts +0 -7
  56. package/lib/plugins/linksPlugin/resolvePaths.js +0 -38
  57. package/lib/plugins/tocPlugin/createRenderHeaders.d.ts +0 -5
  58. package/lib/plugins/tocPlugin/createRenderHeaders.js +0 -28
  59. package/lib/plugins/tocPlugin/createTocBlockRule.d.ts +0 -11
  60. package/lib/plugins/tocPlugin/createTocBlockRule.js +0 -50
  61. package/lib/plugins/tocPlugin/index.d.ts +0 -3
  62. package/lib/plugins/tocPlugin/index.js +0 -15
  63. package/lib/plugins/tocPlugin/tocPlugin.d.ts +0 -65
  64. package/lib/plugins/tocPlugin/tocPlugin.js +0 -56
  65. package/lib/types.d.ts +0 -62
  66. package/lib/types.js +0 -2
  67. package/lib/utils/index.d.ts +0 -3
  68. package/lib/utils/index.js +0 -15
  69. package/lib/utils/parseEmoji.d.ts +0 -1
  70. package/lib/utils/parseEmoji.js +0 -6
  71. package/lib/utils/resolveHeadersFromTokens.d.ts +0 -12
  72. package/lib/utils/resolveHeadersFromTokens.js +0 -83
  73. package/lib/utils/slugify.d.ts +0 -1
  74. package/lib/utils/slugify.js +0 -24
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-present, Yuxi (Evan) You
3
+ Copyright (c) 2018-present, VuePress Community
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @vuepress/markdown
2
+
3
+ [![npm](https://badgen.net/npm/v/@vuepress/markdown/next)](https://www.npmjs.com/package/@vuepress/markdown)
4
+ [![license](https://badgen.net/github/license/vuepress/core)](https://github.com/vuepress/core/blob/main/LICENSE)
5
+
6
+ ## Documentation
7
+
8
+ https://v2.vuepress.vuejs.org
9
+
10
+ ## License
11
+
12
+ [MIT](https://github.com/vuepress/core/blob/main/LICENSE)
@@ -0,0 +1,188 @@
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
+
19
+ type AnchorPluginOptions = anchorPlugin.AnchorOptions;
20
+
21
+ 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;
30
+ }
31
+ /**
32
+ * Plugin to handle assets links
33
+ */
34
+ 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
+
78
+ interface ImportCodePluginOptions {
79
+ /**
80
+ * A function to handle the import path
81
+ */
82
+ handleImportPath?: (str: string) => string;
83
+ }
84
+ declare const importCodePlugin: PluginWithOptions<ImportCodePluginOptions>;
85
+
86
+ interface LinksPluginOptions {
87
+ /**
88
+ * Tag for internal links
89
+ *
90
+ * @default 'RouterLink'
91
+ */
92
+ internalTag?: 'a' | '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>;
105
+ }
106
+ /**
107
+ * Process links in markdown file
108
+ *
109
+ * - internal links: convert them into `<RouterLink>`
110
+ * - external links: add extra attrs and external icon
111
+ */
112
+ declare const linksPlugin: PluginWithOptions<LinksPluginOptions>;
113
+
114
+ 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;
130
+ }
131
+ /**
132
+ * Headers in markdown file
133
+ */
134
+ type MarkdownHeader = PageHeader;
135
+ /**
136
+ * Internal links in markdown file
137
+ *
138
+ * Used for file existence check
139
+ */
140
+ interface MarkdownLink {
141
+ raw: string;
142
+ relative: string;
143
+ absolute: string;
144
+ }
145
+ /**
146
+ * The `env` object to be passed to markdown-it render function
147
+ *
148
+ * Input some meta data for markdown file parsing and rendering
149
+ *
150
+ * Output some resources from the markdown file
151
+ */
152
+ 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[];
177
+ }
178
+ /**
179
+ * Type of `slugify` function
180
+ */
181
+ type MarkdownSlugifyFunction = (str: string) => string;
182
+
183
+ /**
184
+ * Create vuepress customized markdown-it instance
185
+ */
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 };