File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed
theme-coreui/src/client/components Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,11 @@ import include_plugin from 'markdown-it-include'
4
4
import { defaultTheme } from './theme-coreui'
5
5
6
6
import { containerPlugin } from '@vuepress/plugin-container'
7
+ import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
7
8
import { tocPlugin } from '@vuepress/plugin-toc'
9
+ import { getDirname , path } from '@vuepress/utils'
10
+
11
+ const __dirname = getDirname ( import . meta. url )
8
12
9
13
export default defineUserConfig ( {
10
14
base : `/vue/docs/` ,
@@ -63,6 +67,11 @@ export default defineUserConfig({
63
67
} ,
64
68
} ) ,
65
69
tocPlugin ( { } ) ,
70
+ registerComponentsPlugin ( {
71
+ components : {
72
+ ScssDocs : path . resolve ( __dirname , './theme-coreui/src/client/components/ScssDocs.vue' ) ,
73
+ } ,
74
+ } ) ,
66
75
] ,
67
76
theme : defaultTheme ( {
68
77
sidebar : [
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div className =" highlight" >
3
+ <pre class =" prism-code language-scss" v-html =" code" :style =" { 'max-height': '100%' }" />
4
+ </div >
5
+ </template >
6
+
7
+ <script lang="ts">
8
+ import { defineComponent } from ' vue'
9
+ import Prism from ' prismjs'
10
+ import ' prismjs/components/prism-jsx'
11
+ import ' prismjs/components/prism-scss'
12
+ export default defineComponent ({
13
+ name: ' ScssDocs' ,
14
+ props: {
15
+ capture: String ,
16
+ file: String ,
17
+ },
18
+ setup(props ) {
19
+
20
+ if (typeof window !== ' undefined' ) {
21
+ window .Prism = window .Prism || {};
22
+ window .Prism .manual = true ;
23
+ }
24
+
25
+ const files = import .meta .glob (` ../../../../../../../node_modules/@coreui/coreui/scss/**/*.scss ` , {
26
+ as: ' raw' ,
27
+ eager: true ,
28
+ })
29
+ const file = files [` ../../../../../../../node_modules/@coreui/coreui/scss/${props .file } ` ]
30
+
31
+ const captureStart = ` // scss-docs-start ${props .capture } `
32
+ const captureEnd = ` // scss-docs-end ${props .capture } `
33
+ const re = new RegExp (` ${captureStart }((?:.|\n )*)${captureEnd } ` )
34
+ const captured = re .exec (file )
35
+ const section = captured && captured [1 ].trim ()
36
+ const code = section
37
+ ? Prism .highlight (
38
+ section
39
+ .replaceAll (' --#{$prefix}' , ' --cui-' )
40
+ .replaceAll (' \n -' , ' \n -' )
41
+ .replaceAll (' \n @' , ' \n @' ),
42
+ Prism .languages .scss ,
43
+ ' scss' ,
44
+ )
45
+ : null
46
+ return {
47
+ code ,
48
+ }
49
+ },
50
+ })
51
+ </script >
Original file line number Diff line number Diff line change 15
15
"@coreui/vue-chartjs" : " ^2.0.1" ,
16
16
"@docsearch/css" : " ^3.4.0" ,
17
17
"@docsearch/js" : " ^3.4.0" ,
18
+ "@vuepress/plugin-register-components" : " 2.0.0-beta.62" ,
18
19
"@vuepress/plugin-toc" : " 2.0.0-beta.62" ,
19
20
"markdown-it-include" : " ^2.0.0" ,
20
21
"vue-docgen-cli" : " ^4.67.0" ,
You can’t perform that action at this time.
0 commit comments