@vuepress/markdown 2.0.0-rc.15 → 2.0.0-rc.17
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 +10 -10
- package/dist/index.js +26 -24
- package/package.json +4 -4
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -89,19 +89,19 @@ declare const vPrePlugin: PluginWithOptions<VPrePluginOptions>;
|
|
|
89
89
|
type Markdown = MarkdownIt;
|
|
90
90
|
|
|
91
91
|
interface MarkdownOptions extends Options$1 {
|
|
92
|
-
anchor?:
|
|
93
|
-
assets?:
|
|
92
|
+
anchor?: AnchorPluginOptions | false;
|
|
93
|
+
assets?: AssetsPluginOptions | false;
|
|
94
94
|
component?: false;
|
|
95
|
-
emoji?:
|
|
96
|
-
frontmatter?:
|
|
97
|
-
headers?:
|
|
95
|
+
emoji?: EmojiPluginOptions | false;
|
|
96
|
+
frontmatter?: FrontmatterPluginOptions | false;
|
|
97
|
+
headers?: HeadersPluginOptions | false;
|
|
98
98
|
title?: false;
|
|
99
|
-
importCode?:
|
|
100
|
-
links?:
|
|
101
|
-
sfc?:
|
|
99
|
+
importCode?: ImportCodePluginOptions | false;
|
|
100
|
+
links?: LinksPluginOptions | false;
|
|
101
|
+
sfc?: SfcPluginOptions | false;
|
|
102
102
|
slugify?: MarkdownSlugifyFunction;
|
|
103
|
-
toc?:
|
|
104
|
-
vPre?:
|
|
103
|
+
toc?: TocPluginOptions | false;
|
|
104
|
+
vPre?: VPrePluginOptions | false;
|
|
105
105
|
/**
|
|
106
106
|
* @deprecated This feature has been removed. Please use `@vuepress/plugin-prismjs` or `@vuepress/plugin-shiki` instead.
|
|
107
107
|
*/
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { titlePlugin } from "@mdit-vue/plugin-title";
|
|
|
18
18
|
import { tocPlugin } from "@mdit-vue/plugin-toc";
|
|
19
19
|
|
|
20
20
|
// src/plugins/anchorPlugin.ts
|
|
21
|
-
import
|
|
21
|
+
import anchorPlugin from "markdown-it-anchor";
|
|
22
22
|
|
|
23
23
|
// src/plugins/assetsPlugin/resolveLink.ts
|
|
24
24
|
import { path } from "@vuepress/utils";
|
|
@@ -81,7 +81,7 @@ var assetsPlugin = (md, {
|
|
|
81
81
|
(_, prefix, quote, srcset) => `${prefix}${quote}${srcset.split(",").map(
|
|
82
82
|
(item) => item.trim().replace(
|
|
83
83
|
/^([^ ]*?)([ \n].*)?$/,
|
|
84
|
-
(
|
|
84
|
+
(__, url, descriptor = "") => `${resolveLink(url.trim(), {
|
|
85
85
|
env,
|
|
86
86
|
absolutePathPrependBase,
|
|
87
87
|
relativePathPrefix,
|
|
@@ -180,15 +180,18 @@ var importCodePlugin = (md, options = {}) => {
|
|
|
180
180
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
181
181
|
}
|
|
182
182
|
);
|
|
183
|
-
md.renderer.rules.import_code = (tokens, idx,
|
|
183
|
+
md.renderer.rules.import_code = (tokens, idx, opts, env, slf) => {
|
|
184
184
|
const token = tokens[idx];
|
|
185
|
-
const { importFilePath, importCode } = resolveImportCode(
|
|
185
|
+
const { importFilePath, importCode } = resolveImportCode(
|
|
186
|
+
token.meta,
|
|
187
|
+
env
|
|
188
|
+
);
|
|
186
189
|
token.content = importCode;
|
|
187
190
|
if (importFilePath) {
|
|
188
191
|
;
|
|
189
192
|
(env.importedFiles ??= []).push(importFilePath);
|
|
190
193
|
}
|
|
191
|
-
return md.renderer.rules.fence(tokens, idx,
|
|
194
|
+
return md.renderer.rules.fence(tokens, idx, opts, env, slf);
|
|
192
195
|
};
|
|
193
196
|
};
|
|
194
197
|
|
|
@@ -209,18 +212,16 @@ var resolvePaths = (rawPath, base, filePathRelative) => {
|
|
|
209
212
|
absolutePath = rawPath;
|
|
210
213
|
relativePath = path4.relative(base, absolutePath);
|
|
211
214
|
}
|
|
215
|
+
} else if (filePathRelative) {
|
|
216
|
+
relativePath = path4.join(
|
|
217
|
+
// file path may contain non-ASCII characters
|
|
218
|
+
path4.dirname(encodeURI(filePathRelative)),
|
|
219
|
+
rawPath
|
|
220
|
+
);
|
|
221
|
+
absolutePath = path4.join(base, relativePath);
|
|
212
222
|
} else {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
// file path may contain non-ASCII characters
|
|
216
|
-
path4.dirname(encodeURI(filePathRelative)),
|
|
217
|
-
rawPath
|
|
218
|
-
);
|
|
219
|
-
absolutePath = path4.join(base, relativePath);
|
|
220
|
-
} else {
|
|
221
|
-
relativePath = rawPath.replace(/^(?:\.\/)?(.*)$/, "$1");
|
|
222
|
-
absolutePath = null;
|
|
223
|
-
}
|
|
223
|
+
relativePath = rawPath.replace(/^(?:\.\/)?(.*)$/, "$1");
|
|
224
|
+
absolutePath = null;
|
|
224
225
|
}
|
|
225
226
|
return {
|
|
226
227
|
absolutePath,
|
|
@@ -247,9 +248,9 @@ var linksPlugin = (md, options = {}) => {
|
|
|
247
248
|
const hrefLink = hrefAttr[1];
|
|
248
249
|
const { base = "/", filePathRelative = null } = env;
|
|
249
250
|
if (isLinkExternal(hrefLink, base)) {
|
|
250
|
-
Object.entries(externalAttrs).forEach(
|
|
251
|
-
|
|
252
|
-
);
|
|
251
|
+
Object.entries(externalAttrs).forEach(([key, val]) => {
|
|
252
|
+
token.attrSet(key, val);
|
|
253
|
+
});
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
256
|
const internalLinkMatch = hrefLink.match(
|
|
@@ -284,16 +285,16 @@ var linksPlugin = (md, options = {}) => {
|
|
|
284
285
|
absolute: absolutePath
|
|
285
286
|
});
|
|
286
287
|
};
|
|
287
|
-
md.renderer.rules.link_open = (tokens, idx,
|
|
288
|
+
md.renderer.rules.link_open = (tokens, idx, opts, env, self) => {
|
|
288
289
|
handleLinkOpen(tokens, idx, env);
|
|
289
|
-
return self.renderToken(tokens, idx,
|
|
290
|
+
return self.renderToken(tokens, idx, opts);
|
|
290
291
|
};
|
|
291
|
-
md.renderer.rules.link_close = (tokens, idx,
|
|
292
|
+
md.renderer.rules.link_close = (tokens, idx, opts, _env, self) => {
|
|
292
293
|
if (hasOpenInternalLink) {
|
|
293
294
|
hasOpenInternalLink = false;
|
|
294
295
|
tokens[idx].tag = internalTag;
|
|
295
296
|
}
|
|
296
|
-
return self.renderToken(tokens, idx,
|
|
297
|
+
return self.renderToken(tokens, idx, opts);
|
|
297
298
|
};
|
|
298
299
|
};
|
|
299
300
|
|
|
@@ -334,6 +335,7 @@ var vPrePlugin = (md, { inline = true, block = true } = {}) => {
|
|
|
334
335
|
var createMarkdown = ({
|
|
335
336
|
anchor,
|
|
336
337
|
assets,
|
|
338
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
337
339
|
code,
|
|
338
340
|
vPre,
|
|
339
341
|
component,
|
|
@@ -371,7 +373,7 @@ var createMarkdown = ({
|
|
|
371
373
|
if (code) {
|
|
372
374
|
logger2.warn(
|
|
373
375
|
`\`markdown.code\` option has been removed, please use '@vuepress/plugin-shiki' or '@vuepress/plugin-prismjs' instead.
|
|
374
|
-
See https://
|
|
376
|
+
See https://vuepress.vuejs.org/reference/config.html#markdown-code`
|
|
375
377
|
);
|
|
376
378
|
}
|
|
377
379
|
if (component !== false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/markdown",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.17",
|
|
4
4
|
"description": "Markdown package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"@types/markdown-it": "^14.1.2",
|
|
39
39
|
"@types/markdown-it-emoji": "^3.0.1",
|
|
40
40
|
"markdown-it": "^14.1.0",
|
|
41
|
-
"markdown-it-anchor": "^9.0
|
|
41
|
+
"markdown-it-anchor": "^9.2.0",
|
|
42
42
|
"markdown-it-emoji": "^3.0.0",
|
|
43
43
|
"mdurl": "^2.0.0",
|
|
44
|
-
"@vuepress/
|
|
45
|
-
"@vuepress/
|
|
44
|
+
"@vuepress/shared": "2.0.0-rc.17",
|
|
45
|
+
"@vuepress/utils": "2.0.0-rc.17"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/mdurl": "^2.0.0"
|