11import { defineUserConfig } from 'vuepress'
22import { viteBundler } from '@vuepress/bundler-vite'
3- import anchor from 'markdown-it-anchor'
4- import include_plugin from 'markdown-it-include'
5- import { defaultTheme } from './src/node/defaultTheme'
6-
7- import { containerPlugin } from '@vuepress/plugin-container'
3+ import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links'
4+ import { backToTopPlugin } from '@vuepress/plugin-back-to-top'
5+ import { markdownContainerPlugin } from '@vuepress/plugin-markdown-container'
6+ import { prismjsPlugin } from '@vuepress/plugin-prismjs'
87import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
98import { tocPlugin } from '@vuepress/plugin-toc'
109import { getDirname , path } from '@vuepress/utils'
10+ import anchor from 'markdown-it-anchor'
11+ import include_plugin from 'markdown-it-include'
12+ import { defaultTheme } from './src/node'
1113
14+ import { fileURLToPath , URL } from 'url'
1215const __dirname = getDirname ( import . meta. url )
1316
1417export default defineUserConfig ( {
1518 base : `/vue/docs/` ,
1619 lang : 'en-US' ,
1720 title : 'Vue UI Components · CoreUI' ,
1821 description : 'UI Components Library for Vue.js (Vue 3)' ,
19- head : [
20- [ 'link' , { rel : 'icon' , href : `/vue/docs/favicons/favicon-96x96.png` } ] ,
21- ] ,
22- bundler : viteBundler ( {
23- viteOptions : { } ,
24- vuePluginOptions : { } ,
25- } ) ,
22+ head : [ [ 'link' , { rel : 'icon' , href : `/vue/docs/favicons/favicon-96x96.png` } ] ] ,
23+ bundler : viteBundler ( ) ,
2624 markdown : {
2725 anchor : {
2826 permalink : anchor . permalink . ariaHidden ( {
2927 class : 'anchor-link' ,
30- placement : 'after'
31- } )
32- } ,
33- code : {
34- lineNumbers : false ,
28+ placement : 'after' ,
29+ } ) ,
3530 } ,
3631 } ,
3732 extendsMarkdown : ( md ) => {
@@ -41,53 +36,42 @@ export default defineUserConfig({
4136 } )
4237 } ,
4338 plugins : [
44- containerPlugin ( {
39+ activeHeaderLinksPlugin ( {
40+ headerLinkSelector : 'a.sidebar-item' ,
41+ headerAnchorSelector : '.header-anchor' ,
42+ // should greater than page transition duration
43+ delay : 300 ,
44+ } ) ,
45+ // backToTopPlugin(),
46+ markdownContainerPlugin ( {
4547 type : 'demo' ,
46- render : function ( tokens , idx ) {
47- if ( tokens [ idx ] . nesting === 1 ) {
48- return '<div class="docs-example rounded-top p-4">\n'
49- } else {
50- return '</div>\n'
51- }
52- } ,
48+ before : ( ) : string => `<div class="docs-example rounded-top p-4">\n` ,
49+ after : ( ) : string => '</div>\n' ,
5350 } ) ,
54- containerPlugin ( {
55- type : 'demo-rounded' ,
56- render : function ( tokens , idx ) {
57- if ( tokens [ idx ] . nesting === 1 ) {
58- return '<div class="docs-example rounded p-4">\n'
59- } else {
60- return '</div>\n'
61- }
62- } ,
51+ markdownContainerPlugin ( {
52+ type : 'demo-bg-secondary' ,
53+ before : ( ) : string =>
54+ `<div class="docs-example rounded-top p-0 bg-body-secondary overflow-hidden">\n` ,
55+ after : ( ) : string => '</div>\n' ,
6356 } ) ,
64- containerPlugin ( {
57+ markdownContainerPlugin ( {
6558 type : 'demo-dark' ,
66- render : function ( tokens , idx ) {
67- if ( tokens [ idx ] . nesting === 1 ) {
68- return '<div class="docs-example rounded-top p-4 bg-dark">\n'
69- } else {
70- return '</div>\n'
71- }
72- } ,
59+ before : ( ) : string => `<div class="docs-example rounded-top p-4 bg-dark">\n` ,
60+ after : ( ) : string => '</div>\n' ,
7361 } ) ,
74- containerPlugin ( {
75- type : 'demo-bg-secondary' ,
76- render : function ( tokens , idx ) {
77- if ( tokens [ idx ] . nesting === 1 ) {
78- return '<div class="docs-example rounded-top p-0 bg-body-secondary overflow-hidden">\n'
79- } else {
80- return '</div>\n'
81- }
82- } ,
62+ markdownContainerPlugin ( {
63+ type : 'demo-rounded' ,
64+ before : ( ) : string => `<div class="docs-example rounded p-4">\n` ,
65+ after : ( ) : string => '</div>\n' ,
8366 } ) ,
84- tocPlugin ( { } ) ,
67+ prismjsPlugin ( ) ,
8568 registerComponentsPlugin ( {
8669 components : {
8770 Callout : path . resolve ( __dirname , './src/client/components/Callout.vue' ) ,
8871 ScssDocs : path . resolve ( __dirname , './src/client/components/ScssDocs.vue' ) ,
8972 } ,
9073 } ) ,
74+ tocPlugin ( { } ) ,
9175 ] ,
9276 theme : defaultTheme ( {
9377 sidebar : [
0 commit comments