Perf: highlight.js --> prism (#1865)
* perf: highlight.js --> prism * fix: wrong mentions routepull/1877/head
							parent
							
								
									9670ecb6b1
								
							
						
					
					
						commit
						8bb978debe
					
				| 
						 | 
				
			
			@ -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';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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'),
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue