@vuepress/markdown 2.0.0-rc.14 → 2.0.0-rc.16

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
@@ -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?: false | AnchorPluginOptions;
93
- assets?: false | AssetsPluginOptions;
92
+ anchor?: AnchorPluginOptions | false;
93
+ assets?: AssetsPluginOptions | false;
94
94
  component?: false;
95
- emoji?: false | EmojiPluginOptions;
96
- frontmatter?: false | FrontmatterPluginOptions;
97
- headers?: false | HeadersPluginOptions;
95
+ emoji?: EmojiPluginOptions | false;
96
+ frontmatter?: FrontmatterPluginOptions | false;
97
+ headers?: HeadersPluginOptions | false;
98
98
  title?: false;
99
- importCode?: false | ImportCodePluginOptions;
100
- links?: false | LinksPluginOptions;
101
- sfc?: false | SfcPluginOptions;
99
+ importCode?: ImportCodePluginOptions | false;
100
+ links?: LinksPluginOptions | false;
101
+ sfc?: SfcPluginOptions | false;
102
102
  slugify?: MarkdownSlugifyFunction;
103
- toc?: false | TocPluginOptions;
104
- vPre?: false | VPrePluginOptions;
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 { default as anchorPlugin } from "markdown-it-anchor";
21
+ import anchorPlugin from "markdown-it-anchor";
22
22
 
23
23
  // src/plugins/assetsPlugin/resolveLink.ts
24
24
  import { path } from "@vuepress/utils";
@@ -69,7 +69,7 @@ var assetsPlugin = (md, {
69
69
  };
70
70
  const createHtmlRule = (rawHtmlRule) => (tokens, idx, options, env, self) => {
71
71
  tokens[idx].content = tokens[idx].content.replace(
72
- /(<img\b.*?src=)(['"])([^\2]*?)\2/gs,
72
+ /(<img\b.*?src=)(['"])(.*?)\2/gs,
73
73
  (_, prefix, quote, src) => `${prefix}${quote}${resolveLink(src.trim(), {
74
74
  env,
75
75
  absolutePathPrependBase,
@@ -77,11 +77,11 @@ var assetsPlugin = (md, {
77
77
  strict: true
78
78
  })}${quote}`
79
79
  ).replace(
80
- /(<img\b.*?srcset=)(['"])([^\2]*?)\2/gs,
80
+ /(<img\b.*?srcset=)(['"])(.*?)\2/gs,
81
81
  (_, prefix, quote, srcset) => `${prefix}${quote}${srcset.split(",").map(
82
82
  (item) => item.trim().replace(
83
83
  /^([^ ]*?)([ \n].*)?$/,
84
- (_2, url, descriptor = "") => `${resolveLink(url.trim(), {
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, options2, env, slf) => {
183
+ md.renderer.rules.import_code = (tokens, idx, opts, env, slf) => {
184
184
  const token = tokens[idx];
185
- const { importFilePath, importCode } = resolveImportCode(token.meta, env);
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, options2, env, slf);
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
- if (filePathRelative) {
214
- relativePath = path4.join(
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
- ([key, val]) => token.attrSet(key, val)
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, options2, env, self) => {
288
+ md.renderer.rules.link_open = (tokens, idx, opts, env, self) => {
288
289
  handleLinkOpen(tokens, idx, env);
289
- return self.renderToken(tokens, idx, options2);
290
+ return self.renderToken(tokens, idx, opts);
290
291
  };
291
- md.renderer.rules.link_close = (tokens, idx, options2, _env, self) => {
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, options2);
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://v2.vuepress.vuejs.org/reference/config.html#markdown-code`
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.14",
3
+ "version": "2.0.0-rc.16",
4
4
  "description": "Markdown package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -35,14 +35,14 @@
35
35
  "@mdit-vue/plugin-toc": "^2.1.3",
36
36
  "@mdit-vue/shared": "^2.1.3",
37
37
  "@mdit-vue/types": "^2.1.0",
38
- "@types/markdown-it": "^14.1.1",
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.1",
41
+ "markdown-it-anchor": "^9.2.0",
42
42
  "markdown-it-emoji": "^3.0.0",
43
43
  "mdurl": "^2.0.0",
44
- "@vuepress/shared": "2.0.0-rc.14",
45
- "@vuepress/utils": "2.0.0-rc.14"
44
+ "@vuepress/utils": "2.0.0-rc.16",
45
+ "@vuepress/shared": "2.0.0-rc.16"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/mdurl": "^2.0.0"