Perf: highlight.js --> prism (#1865)

* perf: highlight.js --> prism

* fix: wrong mentions route
pull/1877/head
Amour1688 2020-03-12 22:49:03 +08:00 committed by GitHub
parent 9670ecb6b1
commit 8bb978debe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 7 deletions

View File

@ -28,7 +28,6 @@ let { componentName } = require('./config').dev;
const componentsInPrototype = ['Modal', 'message', 'notification'];
const MAIN_TEMPLATE = `import 'babel-polyfill';
import 'highlight.js/styles/solarized-light.css';
import Vue from 'vue';
import Vuex from 'vuex';
import VueI18n from 'vue-i18n';

View File

@ -1,5 +1,5 @@
const path = require('path');
const hljs = require('highlight.js');
const Prism = require('prismjs');
const Token = require('markdown-it/lib/token');
const cheerio = require('cheerio');
const WebpackBar = require('webpackbar');
@ -43,12 +43,12 @@ const replaceDelimiters = function(str) {
*/
const renderHighlight = function(str, lang) {
if (!(lang && hljs.getLanguage(lang))) {
if (!(lang && Prism.languages[lang])) {
return '';
}
try {
return replaceDelimiters(hljs.highlight(lang, str, true).value);
return replaceDelimiters(Prism.highlight(str, Prism.languages[lang], lang));
} catch (err) {}
};

View File

@ -139,6 +139,7 @@
"postcss-loader": "^3.0.0",
"prettier": "^1.18.2",
"pretty-quick": "^2.0.0",
"prismjs": "^1.19.0",
"querystring": "^0.2.0",
"raw-loader": "^4.0.0",
"reqwest": "^2.0.5",
@ -216,4 +217,4 @@
"lib/**/style/*",
"*.less"
]
}
}

View File

@ -80,7 +80,7 @@ export default [
component: () => import('../antdv-demo/input/demo/index.vue'),
},
{
path: 'mentions-cn',
path: 'mentions',
component: () => import('../antdv-demo/mentions/demo/index.vue'),
},
{

View File

@ -2,7 +2,6 @@ import 'babel-polyfill';
import '../components/style.js';
import './index.less';
import 'nprogress/nprogress.css';
import 'highlight.js/styles/solarized-light.css';
import Vue from 'vue';
import Vuex from 'vuex';
import VueI18n from 'vue-i18n';