vuepress-theme-uniapp-official 1.6.1 → 1.6.2
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.
|
@@ -15,26 +15,18 @@ function transfromLang(lang) {
|
|
|
15
15
|
|
|
16
16
|
export async function renderMarkdown(md) {
|
|
17
17
|
if (!markedInstance) {
|
|
18
|
-
const [
|
|
19
|
-
import('marked'),
|
|
20
|
-
import('marked-highlight'),
|
|
21
|
-
import('highlight.js'),
|
|
22
|
-
]);
|
|
23
|
-
|
|
24
|
-
const marked = new Marked(
|
|
25
|
-
markedHighlight({
|
|
26
|
-
emptyLangClass: 'hljs',
|
|
27
|
-
langPrefix: 'hljs language-',
|
|
28
|
-
highlight(code, lang, info) {
|
|
29
|
-
const language = transfromLang(lang);
|
|
30
|
-
return hljs.highlight(code, { language }).value;
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
);
|
|
18
|
+
const [marked, hljs] = await Promise.all([import('marked'), import('highlight.js')]);
|
|
34
19
|
|
|
35
20
|
marked.setOptions({
|
|
36
21
|
headerIds: false,
|
|
37
22
|
mangle: false,
|
|
23
|
+
highlight(code, lang) {
|
|
24
|
+
lang = transfromLang(lang);
|
|
25
|
+
if (lang && hljs.getLanguage(lang)) {
|
|
26
|
+
return hljs.highlight(code, { language: lang }).value;
|
|
27
|
+
}
|
|
28
|
+
return hljs.highlightAuto(code).value;
|
|
29
|
+
},
|
|
38
30
|
});
|
|
39
31
|
|
|
40
32
|
markedInstance = marked;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuepress-theme-uniapp-official",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "uni-app official website theme for vuepress",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,7 @@
|
|
|
39
39
|
"markdown-it-attrs": "^4.1.6",
|
|
40
40
|
"markdown-it-raw-table": "^1.0.0",
|
|
41
41
|
"markdown-it-task-lists": "^2.1.1",
|
|
42
|
-
"marked": "^
|
|
43
|
-
"marked-highlight": "^2.2.3",
|
|
42
|
+
"marked": "^3.0.8",
|
|
44
43
|
"qr-code-with-logo": "^1.1.0",
|
|
45
44
|
"vuepress-plugin-juejin-style-copy": "^1.0.4",
|
|
46
45
|
"vuepress-plugin-mermaidjs": "1.9.1",
|