File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import '@/plugins/copy-code/copy-code';
3030import createHighLinesPlugin from '@/plugins/highlight-lines/' ;
3131import '@/plugins/highlight-lines/highlight-lines' ;
3232import createMermaidPlugin from '@/plugins/mermaid/cdn' ;
33+ import createAlignPlugin from '@/plugins/align' ;
3334
3435import vuepressTheme from '@/theme/vuepress' ;
3536import enUS from '@/lang/en-US' ;
@@ -43,7 +44,8 @@ VueMarkdownEditor.use(createEmojiPlugin())
4344 . use ( createLineNumberPlugin ( ) )
4445 . use ( createCopyCodePlugin ( ) )
4546 . use ( createHighLinesPlugin ( ) )
46- . use ( createMermaidPlugin ( ) ) ;
47+ . use ( createMermaidPlugin ( ) )
48+ . use ( createAlignPlugin ( ) ) ;
4749
4850// VueMarkdownEditor.use(githubTheme, {
4951// codeHighlightExtensionMap: {
Original file line number Diff line number Diff line change 1+ import markdownItContainer from '@/utils/markdown-it-container' ;
2+
3+ const extendMarkdown = function ( mdParser ) {
4+ if ( mdParser ) {
5+ markdownItContainer ( mdParser , {
6+ type : 'align-left' ,
7+ defaultTitle : '' ,
8+ before : ( info ) => `<div align="left">${ info || '' } \n` ,
9+ after : ( ) => '</div>\n' ,
10+ } ) ;
11+
12+ markdownItContainer ( mdParser , {
13+ type : 'align-center' ,
14+ defaultTitle : '' ,
15+ before : ( info ) => `<div align="center">${ info || '' } \n` ,
16+ after : ( ) => '</div>\n' ,
17+ } ) ;
18+
19+ markdownItContainer ( mdParser , {
20+ type : 'align-right' ,
21+ defaultTitle : '' ,
22+ before : ( info ) => `<div align="right">${ info || '' } \n` ,
23+ after : ( ) => '</div>\n' ,
24+ } ) ;
25+ }
26+ } ;
27+
28+ export default function ( ) {
29+ return {
30+ install ( VMdEditor ) {
31+ VMdEditor . extendMarkdown ( extendMarkdown ) ;
32+ } ,
33+ } ;
34+ }
You can’t perform that action at this time.
0 commit comments