-
Notifications
You must be signed in to change notification settings - Fork 116
/
main.ts
85 lines (78 loc) · 2.15 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import './styles/common.less';
import 'nprogress/nprogress.css';
import { config } from 'md-editor-v3';
// 如果项目里面既有编辑器,又有仅预览模块
// 不要同时引用preview.css和style.css,style.css就包含了preview.css
// 同时引用会出现重复样式,并且打包工具不会剔除这部分
import 'md-editor-v3/lib/style.css';
import MarkExtension from 'markdown-it-mark';
import Anchor from 'markdown-it-anchor';
import LinkAttr from 'markdown-it-link-attributes';
import { lineNumbers } from '@codemirror/view';
// import { basicSetup } from 'codemirror';
import ZH_TW from '@vavt/cm-extension/dist/locale/zh-TW';
import '@vavt/cm-extension/dist/previewTheme/arknights.css';
config({
markdownItPlugins(plugins) {
return [
...plugins,
{
type: 'mark',
plugin: MarkExtension,
options: {}
},
{
type: 'linkAttr',
plugin: LinkAttr,
options: {
matcher(href: string) {
return !href.startsWith('#');
},
attrs: {
target: '_blank'
}
}
},
{
type: 'anchor',
plugin: Anchor,
options: {
// permalink: true,
permalink: Anchor.permalink.headerLink(),
// permalinkSymbol: '#',
// permalinkBefore: false,
// permalinkSpace: false,
slugify(s: string) {
return s;
}
}
}
];
},
codeMirrorExtensions(theme, extensions) {
const _exs = [...extensions, lineNumbers()];
// _exs[1] = basicSetup;
return _exs;
},
editorConfig: {
languageUserDefined: {
ZH_TW
}
},
editorExtensions: {
highlight: {
css: {
atom: {
light:
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/atom-one-dark.min.css',
dark: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/atom-one-dark.min.css'
}
}
}
}
});
createApp(App).use(store).use(router).mount('#app');