@vuepress/markdown 2.0.0-beta.59 → 2.0.0-beta.61
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/dist/index.js +9 -2
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -235,7 +235,8 @@ var codePlugin = (md, {
|
|
|
235
235
|
const language = resolveLanguage(info);
|
|
236
236
|
const languageClass = `${options.langPrefix}${language.name}`;
|
|
237
237
|
const code = options.highlight?.(token.content, language.name, "") || md.utils.escapeHtml(token.content);
|
|
238
|
-
|
|
238
|
+
token.attrJoin("class", languageClass);
|
|
239
|
+
let result = code.startsWith("<pre") ? code : `<pre${slf.renderAttrs(token)}><code>${code}</code></pre>`;
|
|
239
240
|
const useVPre = resolveVPre(info) ?? vPreBlock;
|
|
240
241
|
if (useVPre) {
|
|
241
242
|
result = `<pre v-pre${result.slice("<pre".length)}`;
|
|
@@ -313,11 +314,14 @@ var createImportCodeBlockRule = ({ handleImportPath = (str) => str }) => (state,
|
|
|
313
314
|
};
|
|
314
315
|
|
|
315
316
|
// src/plugins/importCodePlugin/resolveImportCode.ts
|
|
316
|
-
import { fs, path as path3 } from "@vuepress/utils";
|
|
317
|
+
import { colors, fs, logger, path as path3 } from "@vuepress/utils";
|
|
317
318
|
var resolveImportCode = ({ importPath, lineStart, lineEnd }, { filePath }) => {
|
|
318
319
|
let importFilePath = importPath;
|
|
319
320
|
if (!path3.isAbsolute(importPath)) {
|
|
320
321
|
if (!filePath) {
|
|
322
|
+
logger.error(
|
|
323
|
+
`Import file ${colors.magenta(importPath)} can not be resolved`
|
|
324
|
+
);
|
|
321
325
|
return {
|
|
322
326
|
importFilePath: null,
|
|
323
327
|
importCode: "Error when resolving path"
|
|
@@ -326,6 +330,7 @@ var resolveImportCode = ({ importPath, lineStart, lineEnd }, { filePath }) => {
|
|
|
326
330
|
importFilePath = path3.resolve(filePath, "..", importPath);
|
|
327
331
|
}
|
|
328
332
|
if (!fs.existsSync(importFilePath)) {
|
|
333
|
+
logger.error(`Import file ${colors.magenta(importPath)} not found`);
|
|
329
334
|
return {
|
|
330
335
|
importFilePath,
|
|
331
336
|
importCode: "File not found"
|
|
@@ -380,6 +385,7 @@ var resolvePaths = (rawPath, base, filePathRelative) => {
|
|
|
380
385
|
} else {
|
|
381
386
|
if (filePathRelative) {
|
|
382
387
|
relativePath = path4.join(
|
|
388
|
+
// file path may contain non-ASCII characters
|
|
383
389
|
path4.dirname(encodeURI(filePathRelative)),
|
|
384
390
|
rawPath
|
|
385
391
|
);
|
|
@@ -478,6 +484,7 @@ var createMarkdown = ({
|
|
|
478
484
|
} = {}) => {
|
|
479
485
|
const md = MarkdownIt({
|
|
480
486
|
...markdownItOptions,
|
|
487
|
+
// should always enable html option
|
|
481
488
|
html: true
|
|
482
489
|
});
|
|
483
490
|
if (anchor !== false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/markdown",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.61",
|
|
4
4
|
"description": "Markdown package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@mdit-vue/plugin-component": "^0.
|
|
31
|
-
"@mdit-vue/plugin-frontmatter": "^0.
|
|
32
|
-
"@mdit-vue/plugin-headers": "^0.
|
|
33
|
-
"@mdit-vue/plugin-sfc": "^0.
|
|
34
|
-
"@mdit-vue/plugin-title": "^0.
|
|
35
|
-
"@mdit-vue/plugin-toc": "^0.
|
|
36
|
-
"@mdit-vue/shared": "^0.
|
|
37
|
-
"@mdit-vue/types": "^0.
|
|
30
|
+
"@mdit-vue/plugin-component": "^0.12.0",
|
|
31
|
+
"@mdit-vue/plugin-frontmatter": "^0.12.0",
|
|
32
|
+
"@mdit-vue/plugin-headers": "^0.12.0",
|
|
33
|
+
"@mdit-vue/plugin-sfc": "^0.12.0",
|
|
34
|
+
"@mdit-vue/plugin-title": "^0.12.0",
|
|
35
|
+
"@mdit-vue/plugin-toc": "^0.12.0",
|
|
36
|
+
"@mdit-vue/shared": "^0.12.0",
|
|
37
|
+
"@mdit-vue/types": "^0.12.0",
|
|
38
38
|
"@types/markdown-it": "^12.2.3",
|
|
39
39
|
"@types/markdown-it-emoji": "^2.0.2",
|
|
40
40
|
"markdown-it": "^13.0.1",
|
|
41
|
-
"markdown-it-anchor": "^8.6.
|
|
41
|
+
"markdown-it-anchor": "^8.6.7",
|
|
42
42
|
"markdown-it-emoji": "^2.0.2",
|
|
43
43
|
"mdurl": "^1.0.1",
|
|
44
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
45
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
44
|
+
"@vuepress/shared": "2.0.0-beta.61",
|
|
45
|
+
"@vuepress/utils": "2.0.0-beta.61"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/mdurl": "^1.0.2"
|