File tree Expand file tree Collapse file tree 8 files changed +4862
-0
lines changed Expand file tree Collapse file tree 8 files changed +4862
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "presets" : [
3
+ [
4
+ " @babel/env" ,
5
+ {
6
+ "modules" : false
7
+ }
8
+ ]
9
+ ]
10
+ }
Original file line number Diff line number Diff line change
1
+ .DS_Store
2
+ node_modules
3
+ npm-debug.log
4
+ dist
Original file line number Diff line number Diff line change
1
+ # docsify-sidebar-collapse
2
+
3
+ 支持 docsify 目录默认收起,点击具体目录再全部展开
4
+
5
+ ## Install
6
+
7
+ insert script into document like the official plugins
8
+
9
+ ``` html
10
+ <script src =" //unpkg.com/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js" ></script >
11
+ ```
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " docsify-sidebar-collapse" ,
3
+ "version" : " 1.0.1" ,
4
+ "description" : " sidebar-collapse plugin for docsify" ,
5
+ "main" : " src" ,
6
+ "scripts" : {
7
+ "start" : " rollup -c -w" ,
8
+ "clean" : " rimraf ./dist" ,
9
+ "build" : " run-s build:*" ,
10
+ "build:rollup" : " rollup -c" ,
11
+ "build:minify" : " uglifyjs --compress --mangle --output ./dist/docsify-sidebar-collapse.min.js -- ./dist/docsify-sidebar-collapse.js"
12
+ },
13
+ "repository" : {
14
+ "type" : " git" ,
15
+ "url" : " git+https://github.com/iPeng6/docsify-sidebar-collapse.git"
16
+ },
17
+ "keywords" : [
18
+ " docsify" ,
19
+ " sidebar" ,
20
+ " collapse"
21
+ ],
22
+ "files" : [
23
+ " src" ,
24
+ " dist" ,
25
+ " READEME"
26
+ ],
27
+ "author" : " ipeng6" ,
28
+ "license" : " MIT" ,
29
+ "bugs" : {
30
+ "url" : " https://github.com/iPeng6/docsify-sidebar-collapse/issues"
31
+ },
32
+ "homepage" : " https://github.com/iPeng6/docsify-sidebar-collapse#readme" ,
33
+ "devDependencies" : {
34
+ "@babel/core" : " ^7.1.6" ,
35
+ "@babel/preset-env" : " ^7.1.6" ,
36
+ "npm-run-all" : " ^4.1.5" ,
37
+ "rimraf" : " ^2.6.2" ,
38
+ "rollup" : " ^0.67.3" ,
39
+ "rollup-plugin-babel" : " ^4.0.3" ,
40
+ "rollup-plugin-commonjs" : " ^9.2.0" ,
41
+ "rollup-plugin-node-resolve" : " ^3.4.0" ,
42
+ "rollup-plugin-postcss" : " ^1.6.3" ,
43
+ "uglify-js" : " ^3.4.9"
44
+ }
45
+ }
Original file line number Diff line number Diff line change
1
+ import commonjs from 'rollup-plugin-commonjs'
2
+ import resolve from 'rollup-plugin-node-resolve'
3
+ import babel from 'rollup-plugin-babel'
4
+ import postcss from 'rollup-plugin-postcss'
5
+
6
+ export default {
7
+ input : 'src/index.js' ,
8
+ output : {
9
+ file : 'dist/docsify-sidebar-collapse.js' ,
10
+ format : 'umd'
11
+ } ,
12
+ plugins : [
13
+ postcss ( ) ,
14
+ babel ( {
15
+ exclude : 'node_modules/**' // 只编译我们的源代码
16
+ } ) ,
17
+ resolve ( {
18
+ jsnext : true
19
+ } ) ,
20
+ commonjs ( )
21
+ ]
22
+ }
Original file line number Diff line number Diff line change
1
+ import './style.css'
2
+
3
+ $docsify . plugins = [
4
+ function ( hook , vm ) {
5
+ hook . doneEach ( function ( html , next ) {
6
+ let el = document . querySelector ( '.sidebar-nav .active' )
7
+ while ( el && el . className !== 'sidebar-nav' ) {
8
+ if ( el . parentElement . tagName === 'LI' ) {
9
+ el . parentElement . className = 'open'
10
+ }
11
+ el = el . parentElement
12
+ }
13
+ next ( html )
14
+ } )
15
+ }
16
+ ] . concat ( $docsify . plugins || [ ] )
Original file line number Diff line number Diff line change
1
+ .sidebar-nav li {
2
+ position : relative;
3
+ margin : 0 ;
4
+ }
5
+ .sidebar-nav a {
6
+ text-decoration : none;
7
+ padding-left : 8px ;
8
+ }
9
+ .sidebar-nav > ul > li > ul a ::before {
10
+ content : '' ;
11
+ display : block;
12
+ position : absolute;
13
+ top : 0 ;
14
+ left : 0 ;
15
+ height : 15px ;
16
+ width : 6px ;
17
+ border-left : 1px solid # e7e7eb ;
18
+ border-bottom : 1px solid # e7e7eb ;
19
+ }
20
+ .sidebar-nav > ul > li > ul a ::after {
21
+ content : '' ;
22
+ display : block;
23
+ position : absolute;
24
+ top : 0 ;
25
+ left : 0 ;
26
+ bottom : 0 ;
27
+ width : 6px ;
28
+ border-left : 1px solid # e7e7eb ;
29
+ }
30
+ .sidebar-nav li : last-child a ::after {
31
+ display : none;
32
+ }
33
+ .sidebar-nav .app-sub-sidebar a ::before ,
34
+ .sidebar-nav .app-sub-sidebar a ::after {
35
+ display : none;
36
+ }
37
+
38
+ .app-sub-sidebar li ::before {
39
+ content : '#' ;
40
+ }
41
+
42
+ .sidebar-nav a : hover {
43
+ background : # eff1f3 ;
44
+ }
45
+ .sidebar-nav > ul > li > ul {
46
+ display : none;
47
+ }
48
+
49
+ .sidebar-nav .open ul ,
50
+ .sidebar-nav .active ul {
51
+ display : block;
52
+ }
You can’t perform that action at this time.
0 commit comments