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'
44import { defaultTheme } from './theme-coreui'
55
66import { containerPlugin } from '@vuepress/plugin-container'
7+ import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
78import { tocPlugin } from '@vuepress/plugin-toc'
9+ import { getDirname , path } from '@vuepress/utils'
10+
11+ const __dirname = getDirname ( import . meta. url )
812
913export default defineUserConfig ( {
1014 base : `/vue/docs/` ,
@@ -63,6 +67,11 @@ export default defineUserConfig({
6367 } ,
6468 } ) ,
6569 tocPlugin ( { } ) ,
70+ registerComponentsPlugin ( {
71+ components : {
72+ ScssDocs : path . resolve ( __dirname , './theme-coreui/src/client/components/ScssDocs.vue' ) ,
73+ } ,
74+ } ) ,
6675 ] ,
6776 theme : defaultTheme ( {
6877 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 1515 "@coreui/vue-chartjs" : " ^2.0.1" ,
1616 "@docsearch/css" : " ^3.4.0" ,
1717 "@docsearch/js" : " ^3.4.0" ,
18+ "@vuepress/plugin-register-components" : " 2.0.0-beta.62" ,
1819 "@vuepress/plugin-toc" : " 2.0.0-beta.62" ,
1920 "markdown-it-include" : " ^2.0.0" ,
2021 "vue-docgen-cli" : " ^4.67.0" ,
You can’t perform that action at this time.
0 commit comments