Compare commits
710 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d3246a26f |
||
|
|
8ea4865c84 | ||
|
|
676f84cffa | ||
|
|
7bdcadc7d7 | ||
|
|
5bd24fb83c | ||
|
|
76cc0f672b | ||
|
|
3f50381090 | ||
|
|
b847c20cab | ||
|
|
ce829b24d6 |
||
|
|
1ce53cf9ec |
||
|
|
bc1d8e4bda | ||
|
|
78f5564a30 | ||
|
|
6cc069cb9f | ||
|
|
d355272461 | ||
|
|
af161cd3b4 | ||
|
|
5bcb016bee | ||
|
|
b38c2065e0 | ||
|
|
e5bab8d967 | ||
|
|
da3e2d7b18 | ||
|
|
b93a667f24 | ||
|
|
e8d850c9ba | ||
|
|
514a027991 |
||
|
|
314e2d9d39 |
||
|
|
a86de3d81a | ||
|
|
5f960102e7 | ||
|
|
0bd5c8b020 | ||
|
|
044a5ec2b8 | ||
|
|
b15eccfac0 | ||
|
|
4e0298088b |
||
|
|
09616dec06 | ||
|
|
f74b53f53e |
||
|
|
bba44fb536 |
||
|
|
270fa6cb41 |
||
|
|
24e61f5e2f |
||
|
|
ca8ae50717 | ||
|
|
31654f12ec | ||
|
|
d80aa2189b |
||
|
|
21cde83949 |
||
|
|
c1d4961a64 |
||
|
|
2039e0dd1c | ||
|
|
d5910bd1f9 |
||
|
|
a35531967a | ||
|
|
dac0bfec6c | ||
|
|
01ea44106b | ||
|
|
11ea1f8d12 | ||
|
|
bc4d06bb16 | ||
|
|
29d9cda3de | ||
|
|
140bf10377 | ||
|
|
dfd31b5de7 | ||
|
|
d1c72686bb | ||
|
|
8cd786c9d5 |
||
|
|
b53571810b | ||
|
|
cb53106fa7 |
||
|
|
fd86c727af | ||
|
|
69ef489210 | ||
|
|
c3345ba20c | ||
|
|
1447c8a40a | ||
|
|
3b952ac7c3 | ||
|
|
99dbaa3050 | ||
|
|
6ac7bace21 | ||
|
|
28beff80f7 | ||
|
|
049726e11e | ||
|
|
a257a4ab4e | ||
|
|
a07a613312 | ||
|
|
4db8cd6abf | ||
|
|
a72e7490c3 | ||
|
|
cc79e2e992 | ||
|
|
5b6525b8f1 | ||
|
|
aa719e3a47 | ||
|
|
22a5927eaf | ||
|
|
5ab9d8cb87 | ||
|
|
f84242d380 | ||
|
|
1a945d445a |
||
|
|
81ec7c763b | ||
|
|
d91a66cadd | ||
|
|
58b130996e | ||
|
|
ee800a6572 | ||
|
|
6daecc8a68 | ||
|
|
325ecd08e6 | ||
|
|
9a09458eee | ||
|
|
fdd8826b3b |
||
|
|
fcd1087c16 |
||
|
|
ab19b13210 | ||
|
|
5fcf210dd1 | ||
|
|
2edf47ec73 | ||
|
|
b52607dec9 | ||
|
|
e89a2b3fea | ||
|
|
239eb3503b | ||
|
|
fce40eae25 | ||
|
|
d35059dd0b | ||
|
|
4f588e0af4 | ||
|
|
22ab7dfd14 | ||
|
|
4805cb5322 | ||
|
|
2bc880d335 | ||
|
|
b3b6116464 | ||
|
|
137ae8d5b8 | ||
|
|
4a23c4acf2 | ||
|
|
a39b214733 |
||
|
|
1ce37bdc2e | ||
|
|
2cd4646386 | ||
|
|
42ea8af245 | ||
|
|
bf060befb7 | ||
|
|
b329e1eb1d | ||
|
|
63876c601d | ||
|
|
0a0802aded | ||
|
|
94bc415534 | ||
|
|
9e860177cb | ||
|
|
47a8d5faa4 | ||
|
|
18f0f03a89 | ||
|
|
f6f4e32485 | ||
|
|
50c2434ab5 | ||
|
|
1897bb6af0 | ||
|
|
b0179e4c64 | ||
|
|
c6eafa32b1 | ||
|
|
8336769127 | ||
|
|
393e4ec044 | ||
|
|
100ab01811 | ||
|
|
a683e5bf2a | ||
|
|
6a3cbba35b |
||
|
|
a923121be8 | ||
|
|
f7274e141f | ||
|
|
266d13bca6 |
||
|
|
de70d92fda | ||
|
|
75f914354f | ||
|
|
2e793061a8 | ||
|
|
78b3a6d007 | ||
|
|
845b1f2990 |
||
|
|
e281704e83 | ||
|
|
55755010c0 | ||
|
|
73a38c3878 | ||
|
|
62b4fc2121 | ||
|
|
a91d2dab67 | ||
|
|
a961e3b972 | ||
|
|
3c94178805 | ||
|
|
490242fb73 | ||
|
|
5c0de0aefe |
||
|
|
04b36b0ef2 |
||
|
|
3a7ad6299e |
||
|
|
feea7f9b48 |
||
|
|
cd09d91434 | ||
|
|
a5f333a329 | ||
|
|
7dcebe7544 | ||
|
|
cc636e6ca3 | ||
|
|
5523a2a2a9 | ||
|
|
f8f22e5a3c |
||
|
|
ee72dd05e5 |
||
|
|
6c7ebc989d | ||
|
|
57967d2caa | ||
|
|
c2886b1b62 |
||
|
|
2d9e581d63 | ||
|
|
604989ff04 | ||
|
|
26525db433 | ||
|
|
2b0109b89a | ||
|
|
fb144b2e69 | ||
|
|
ac695de859 | ||
|
|
e5a263f1bb | ||
|
|
48e531bcfb | ||
|
|
1f338d2142 | ||
|
|
cf05d7b26c | ||
|
|
cb1a56d89b | ||
|
|
62b7578468 | ||
|
|
410efb2bc2 | ||
|
|
1e99d7b514 | ||
|
|
e4e011c81f | ||
|
|
4cd0e5eb49 | ||
|
|
531e483c31 | ||
|
|
6a3d69ae1a | ||
|
|
ef1b42be23 | ||
|
|
54f45ecb0a | ||
|
|
4c91fbc7cb | ||
|
|
bfd0d18e48 | ||
|
|
74ff68a40e | ||
|
|
e737a42f75 | ||
|
|
a850b29545 | ||
|
|
aeb692ed6b | ||
|
|
01140ceb54 | ||
|
|
87129c0fb2 | ||
|
|
95e95bd23b | ||
|
|
8974f3964e | ||
|
|
75222209da | ||
|
|
8352a1e489 |
||
|
|
9b3b4454de | ||
|
|
0933445e89 | ||
|
|
ec8daca3ec | ||
|
|
1335baa22f | ||
|
|
123c516836 | ||
|
|
ecc0e04c70 | ||
|
|
278a75ebd5 | ||
|
|
b8a4e6ba1b | ||
|
|
01bbbaaf92 | ||
|
|
e5c64a3d8f | ||
|
|
e5ae6e8d25 | ||
|
|
702bb5b715 | ||
|
|
7cdf751cc5 | ||
|
|
6a09059645 | ||
|
|
84f7b5c7c2 | ||
|
|
fd14e14022 | ||
|
|
4b5185f0d7 | ||
|
|
45a7464d23 | ||
|
|
222cfdbbe4 | ||
|
|
890a7bf9b6 | ||
|
|
edc3201367 | ||
|
|
8dd4378e89 | ||
|
|
149d9929f8 | ||
|
|
50fe22563b | ||
|
|
4aafde85fb | ||
|
|
dc0c3ced4e | ||
|
|
62ce447fc3 | ||
|
|
471e407c73 | ||
|
|
8fb74a2d87 | ||
|
|
a41129425f | ||
|
|
e097f88f0e | ||
|
|
033be4f2d7 | ||
|
|
371fbecfc2 | ||
|
|
e810ba38cb | ||
|
|
df84bc73ee | ||
|
|
a0c60b707c | ||
|
|
7a33ec2133 | ||
|
|
cb900a68e5 | ||
|
|
4bdcee2cb3 | ||
|
|
bd7ee84241 | ||
|
|
bf5d999296 | ||
|
|
56608e4739 | ||
|
|
4d61b1e9a3 | ||
|
|
c4d83f26a4 | ||
|
|
248aa72cd2 | ||
|
|
54ab4c9ff7 | ||
|
|
f960c196bf | ||
|
|
85428ef49e | ||
|
|
342438f2a7 | ||
|
|
9e824a4958 | ||
|
|
ebc10c4e43 | ||
|
|
b265fdd68a | ||
|
|
f68ddf5af0 | ||
|
|
9755439670 | ||
|
|
761ccc2c2b | ||
|
|
524f52f882 | ||
|
|
a90a2e49e1 | ||
|
|
864aa181a1 | ||
|
|
5e161a1420 | ||
|
|
820abeb0fd | ||
|
|
b073dd3ace | ||
|
|
c7892e340b |
||
|
|
21336444f4 |
||
|
|
39dd894650 | ||
|
|
30f07b1d5b | ||
|
|
4157173099 | ||
|
|
b133fde32a | ||
|
|
e3c9040419 | ||
|
|
0e479613bc | ||
|
|
368754ebd9 | ||
|
|
1c5d594228 | ||
|
|
0ecdacc7dc | ||
|
|
bedc262d83 | ||
|
|
9d5f561b28 | ||
|
|
5447e4bd47 | ||
|
|
7cb4b58b67 | ||
|
|
4d9bbb0767 | ||
|
|
fea80b508c |
||
|
|
bdcd9de4a2 | ||
|
|
2ec74e3a8d | ||
|
|
20dabdcdd6 | ||
|
|
2b4863381b | ||
|
|
689d3ddeaf | ||
|
|
adf90350c9 | ||
|
|
a12d3930e4 | ||
|
|
299c2c85c0 | ||
|
|
bc3ed08d06 | ||
|
|
d22ea84783 | ||
|
|
7c8d1cee76 | ||
|
|
3a72074405 |
||
|
|
04beaf7bd7 | ||
|
|
c17d892d30 | ||
|
|
623e9c4239 | ||
|
|
5d1fbdc5c9 | ||
|
|
f78be4c900 | ||
|
|
2ab0d7222c | ||
|
|
178ba64157 | ||
|
|
93a995f5bc | ||
|
|
888f217356 | ||
|
|
6bfc81147f | ||
|
|
3af1641874 | ||
|
|
66c8fd501a | ||
|
|
d60f6f0d03 | ||
|
|
2002cb8b22 | ||
|
|
572ab1afae | ||
|
|
d3dc8bcfb7 | ||
|
|
0e693fcda2 | ||
|
|
041b33e967 | ||
|
|
b34a9375c3 | ||
|
|
a1d2a1f1e3 | ||
|
|
e43ded4ea7 | ||
|
|
88df107c70 | ||
|
|
bc3ef52bbe | ||
|
|
9bed441a0c | ||
|
|
af38fc70fd | ||
|
|
4f164e995e | ||
|
|
b77f46a8e3 | ||
|
|
9208e64939 | ||
|
|
405349102f | ||
|
|
9d6595d04b | ||
|
|
d486eef6cc |
||
|
|
b3c3180bab | ||
|
|
c30af850a1 | ||
|
|
2a2ed96eb8 | ||
|
|
0d54c0cf83 | ||
|
|
f27ce7d2b2 | ||
|
|
2e1a7367a8 | ||
|
|
7510f75968 | ||
|
|
fd7d4e0e4e | ||
|
|
025bc5cddf | ||
|
|
8f1066a035 |
||
|
|
800c0c503a | ||
|
|
d5194b4f6b | ||
|
|
fa772cfa94 |
||
|
|
cc98f56cdd | ||
|
|
752f68e5f8 | ||
|
|
bde17e1f10 | ||
|
|
2db197f6dc | ||
|
|
e8b5b09f2c | ||
|
|
36bfc9d91d |
||
|
|
4ad96f3d12 |
||
|
|
1f04912a8f | ||
|
|
65f17b4753 | ||
|
|
b3419f3842 | ||
|
|
0bb7e18018 | ||
|
|
86583e19ab | ||
|
|
0bef31951c | ||
|
|
a2b8eae8c4 | ||
|
|
63d08369f6 | ||
|
|
142623e87e | ||
|
|
ab682684ca | ||
|
|
e16c89e539 | ||
|
|
f1272a2f1c | ||
|
|
1b912272df | ||
|
|
3476f6ff1f | ||
|
|
fac7ce693f | ||
|
|
470ee474d4 | ||
|
|
f7cf95a771 | ||
|
|
4a9d594f7c | ||
|
|
a3ab37952d | ||
|
|
6949455899 | ||
|
|
4e52315564 | ||
|
|
91d6337936 | ||
|
|
26cc466420 | ||
|
|
6f92a871ca | ||
|
|
538ee3d0dc | ||
|
|
49fd30d73d | ||
|
|
abd885e133 | ||
|
|
69b2040571 | ||
|
|
e8d675c405 | ||
|
|
5cc3e6c469 | ||
|
|
3e94cb6d76 | ||
|
|
641e522779 | ||
|
|
026530de10 | ||
|
|
1b74ef31a9 | ||
|
|
25acd8ce77 | ||
|
|
9b4e6669db | ||
|
|
2e3fe59702 | ||
|
|
7923608bc9 | ||
|
|
e307308a78 | ||
|
|
c195d2d1a6 | ||
|
|
0624e592d8 | ||
|
|
aba2aec0d0 | ||
|
|
a9704b5156 | ||
|
|
16d730ec3d | ||
|
|
08afec7d2a | ||
|
|
fcee316d2c | ||
|
|
1d2b546602 | ||
|
|
97793bfd6c | ||
|
|
ae3f74bfd4 | ||
|
|
04eaf4026b | ||
|
|
46ac4c3fd2 | ||
|
|
44dc68c6b2 | ||
|
|
6c702d3362 | ||
|
|
c476e49164 | ||
|
|
0329bab359 | ||
|
|
62aa161bff | ||
|
|
3854692331 | ||
|
|
2066cb672d | ||
|
|
5b7b60c553 | ||
|
|
388ed3d685 | ||
|
|
e898350a84 | ||
|
|
9c62fb41b8 | ||
|
|
9b73b0bf8a | ||
|
|
9d43051791 | ||
|
|
f0aca1905c | ||
|
|
2959497874 | ||
|
|
5a9921f5e7 | ||
|
|
c9d556d829 | ||
|
|
a0e1ea811a | ||
|
|
f82f41900e | ||
|
|
7a4d9bc5cd | ||
|
|
5e522879dd | ||
|
|
a72e7a3a3f | ||
|
|
26c22a9843 | ||
|
|
4ce118d60f | ||
|
|
3ad1645b90 | ||
|
|
41967fa8fa | ||
|
|
48276db15d | ||
|
|
b67ea62c75 | ||
|
|
f4800e09f1 | ||
|
|
ac10de1c5b | ||
|
|
d6ac7031b0 | ||
|
|
4417f4669d | ||
|
|
b7735066ff | ||
|
|
10045249d3 | ||
|
|
190710733e | ||
|
|
b292d819fc | ||
|
|
7f270f93c6 | ||
|
|
c3a149679a | ||
|
|
5efa763075 | ||
|
|
03a04f7898 | ||
|
|
a88252c6b2 | ||
|
|
2f5f90750a | ||
|
|
709c152950 | ||
|
|
b09a5a317e | ||
|
|
628e2115a3 | ||
|
|
271dde8f5e | ||
|
|
1fa1619278 | ||
|
|
3de3def8a8 | ||
|
|
fb25726426 | ||
|
|
36ddc42e91 | ||
|
|
abb0f6019f | ||
|
|
b8dd346baf | ||
|
|
7191d702e1 | ||
|
|
c039f1bfc0 | ||
|
|
f859d2d0b2 | ||
|
|
9735f4036e | ||
|
|
b8a96b867b | ||
|
|
b7b589b1bf | ||
|
|
761e38f6ad | ||
|
|
78899a0251 | ||
|
|
357631c8b7 | ||
|
|
17ff3d1506 | ||
|
|
f59aac478a | ||
|
|
0dd2497467 | ||
|
|
306136f6a3 | ||
|
|
4aba9d0a25 | ||
|
|
3d2f23bcdc | ||
|
|
b85eb0ff4b | ||
|
|
efa8d25912 | ||
|
|
437737cc5a | ||
|
|
992ff77808 | ||
|
|
4cf13db685 | ||
|
|
e54062f80d | ||
|
|
cee8ac6698 |
||
|
|
d057f66fce | ||
|
|
9b0f1978a4 | ||
|
|
d9848c3384 |
||
|
|
4dabae3bf2 |
||
|
|
b430993f4f |
||
|
|
2e00f4c993 | ||
|
|
7fb5ce6c84 |
||
|
|
c4aa22c56d |
||
|
|
9af855921e |
||
|
|
4492c3e19f |
||
|
|
f598e53098 |
||
|
|
4bde6d685c |
||
|
|
ce0e9acd50 |
||
|
|
e8117e515d |
||
|
|
25e09dfe07 | ||
|
|
a6b46a3e26 | ||
|
|
d469442eae | ||
|
|
9f310bbd7d |
||
|
|
cc8a7c97b6 |
||
|
|
19da658ba2 |
||
|
|
97db30a0b9 |
||
|
|
3a0765e11e | ||
|
|
aaf71b1ac0 | ||
|
|
b37781e949 |
||
|
|
54a48dd3ff |
||
|
|
1aabc41db7 |
||
|
|
d087d5753b |
||
|
|
bb793ec08e |
||
|
|
6a78ae7ddc |
||
|
|
ac28040bd7 |
||
|
|
b12f74b159 |
||
|
|
1304d2ea1a |
||
|
|
ccf4c7c5cc |
||
|
|
9b15d8d577 |
||
|
|
642e7da7ee |
||
|
|
75381cf046 |
||
|
|
7e2e5a7c90 |
||
|
|
6d48ce1266 |
||
|
|
d286963da0 |
||
|
|
8a4cedd962 |
||
|
|
a3b7b66a76 | ||
|
|
5a0d4b7897 |
||
|
|
fcfdb17b8d | ||
|
|
e4d2e7ec12 | ||
|
|
ece00e6b3a |
||
|
|
841829427b |
||
|
|
56c7b9ae2d |
||
|
|
db8400a6ac |
||
|
|
955d3d5988 |
||
|
|
d9b487e67b |
||
|
|
91b66a5cac |
||
|
|
90bba60367 |
||
|
|
d05c4f65a8 |
||
|
|
3380a62142 |
||
|
|
8e418a1681 |
||
|
|
20d60c401f |
||
|
|
1938fd5146 |
||
|
|
3b74c49f00 |
||
|
|
22b50f07c3 |
||
|
|
ec887c1b5f |
||
|
|
036fdac131 |
||
|
|
a64cee1236 |
||
|
|
f943fede99 |
||
|
|
e296439df3 |
||
|
|
0014895c19 |
||
|
|
23590fa7e7 |
||
|
|
8689a37121 |
||
|
|
05a0211861 |
||
|
|
318189a13f |
||
|
|
42795a0483 |
||
|
|
6b9e0922cf |
||
|
|
8cb4189b96 |
||
|
|
7eb6346075 |
||
|
|
238e9633f9 |
||
|
|
6db8c9e6c9 |
||
|
|
e160bcaded |
||
|
|
8cf69754b5 |
||
|
|
79a83bc17d |
||
|
|
81c87f7926 |
||
|
|
67ec128315 |
||
|
|
77657e3b64 |
||
|
|
9825db47af |
||
|
|
1a5593889e |
||
|
|
fc9cdf37c5 |
||
|
|
80dba191d3 |
||
|
|
5a0c37fcd3 |
||
|
|
1462efedcd |
||
|
|
4cb20a5f9d |
||
|
|
490c8a19d3 |
||
|
|
4b838247ea |
||
|
|
b091f3f10d |
||
|
|
0e74e6c15e |
||
|
|
be8358fcdc |
||
|
|
1ae0a9a845 |
||
|
|
7e169ad154 |
||
|
|
8595c99c0b |
||
|
|
43fc8b8ab1 |
||
|
|
ccec23df7f |
||
|
|
fc1cd3f11d |
||
|
|
3f38810774 |
||
|
|
3db4841da3 |
||
|
|
b764b6e32c |
||
|
|
46261572e3 |
||
|
|
d53b8dadb3 |
||
|
|
b9b9d87681 |
||
|
|
d4f6072d10 | ||
|
|
891475e132 | ||
|
|
1acfdd335c | ||
|
|
1f4514dcad | ||
|
|
eba1c987a8 | ||
|
|
3444884905 | ||
|
|
6dea685fee | ||
|
|
f095eb888f | ||
|
|
8741c746df | ||
|
|
2c7041c8fb | ||
|
|
2a21c40f17 | ||
|
|
000194c8da | ||
|
|
fce1e47131 |
||
|
|
6d244139dd |
||
|
|
eca3368152 |
||
|
|
bab76e004d | ||
|
|
eb9dc4671a |
||
|
|
bb815cb2d4 |
||
|
|
26db33dc31 |
||
|
|
6cbed4b4d8 |
||
|
|
b948cb06d7 |
||
|
|
b2b474264f |
||
|
|
a8c73ee2b9 |
||
|
|
eda9bb8343 |
||
|
|
50e771e6a8 |
||
|
|
2d73285de5 |
||
|
|
d2be5aecf8 |
||
|
|
ca0d6182b9 | ||
|
|
dacea8a39b | ||
|
|
da75d70dee | ||
|
|
6ed25cebe5 | ||
|
|
ee54141776 | ||
|
|
51832d3506 | ||
|
|
25ccc79e56 | ||
|
|
890d29f982 | ||
|
|
76c041ad48 | ||
|
|
2c277b8f79 | ||
|
|
a5f6ccd1d1 | ||
|
|
11c94b2149 | ||
|
|
2653849a3e | ||
|
|
d7b0d1b949 | ||
|
|
6911fb879b | ||
|
|
137a93c7b2 | ||
|
|
5d5caa1f89 | ||
|
|
1dfd6cdcfe | ||
|
|
91c6db2902 | ||
|
|
94d6603c06 | ||
|
|
920f624b5c | ||
|
|
8fb1350728 | ||
|
|
c1df94662a | ||
|
|
9b7e5f5814 | ||
|
|
432bcfb54b | ||
|
|
4f98497284 | ||
|
|
9220523a40 | ||
|
|
b8100c0755 | ||
|
|
be0230ebe9 | ||
|
|
aa6d2afce8 | ||
|
|
a706203879 | ||
|
|
fbc75bdb95 | ||
|
|
5af174bd20 | ||
|
|
e70327ab2b | ||
|
|
7209b82982 | ||
|
|
594299ffbd | ||
|
|
e9bbfd4c53 | ||
|
|
96bc09211e | ||
|
|
8f11653b41 | ||
|
|
6aae64fd54 | ||
|
|
33b7c512bb | ||
|
|
bf35471a2b | ||
|
|
b022aaf14e | ||
|
|
03d8281868 | ||
|
|
4a0cfa799e | ||
|
|
2c2ac5f461 | ||
|
|
1edcd63cdb | ||
|
|
2d6a51b057 | ||
|
|
bf1ae7802d | ||
|
|
cf9b7c99e4 | ||
|
|
c20f3298d8 | ||
|
|
dd7d9aa4ad | ||
|
|
bba957d3bc | ||
|
|
28b3cb4249 | ||
|
|
97e730d7e3 | ||
|
|
65a6b3c659 | ||
|
|
f6b827f7bc | ||
|
|
24d1b0feb6 | ||
|
|
54da5fb6c8 | ||
|
|
d57b80e224 | ||
|
|
788bbb36b4 | ||
|
|
92070e3099 | ||
|
|
de0ad0f04c | ||
|
|
ceafc37bb3 | ||
|
|
1f19cb2ade | ||
|
|
33393ef0f6 | ||
|
|
4ff8fb2c60 | ||
|
|
9b858fc4c4 | ||
|
|
3aef37a445 | ||
|
|
37daa7ef9c | ||
|
|
b0da9f23d3 | ||
|
|
1f66e61f63 | ||
|
|
5f07d5a9f3 | ||
|
|
d1d8f88a1a | ||
|
|
b9a7275c8f | ||
|
|
0fddd1ced4 | ||
|
|
262bf13964 | ||
|
|
0b1fc2343f | ||
|
|
6eada5a2f7 | ||
|
|
86923d03d3 | ||
|
|
8b696cd99d | ||
|
|
3b30d42e9a | ||
|
|
50fa6fcb89 | ||
|
|
8463f4d5c5 | ||
|
|
9e7d365872 | ||
|
|
9e9ad57540 | ||
|
|
9c54bafae4 | ||
|
|
1aa6636ba8 | ||
|
|
723a6040f2 | ||
|
|
d6b5403982 | ||
|
|
9f0fc83b54 | ||
|
|
b02e1f1409 | ||
|
|
bca7b00c94 | ||
|
|
0ae14e8ddc | ||
|
|
61e0aacb43 | ||
|
|
b927a30cc6 | ||
|
|
0d59ee939f | ||
|
|
0aead898eb | ||
|
|
d3c9fbd124 | ||
|
|
f3fc596951 | ||
|
|
07a2a91296 | ||
|
|
8ad835ca26 | ||
|
|
0994663c5a | ||
|
|
5067769a65 | ||
|
|
92d6e8a1ee | ||
|
|
0dd9feffe5 | ||
|
|
82173627e5 | ||
|
|
507d9e834c | ||
|
|
83ae93cae0 | ||
|
|
8f9bf29ee5 | ||
|
|
d67d25fed4 | ||
|
|
95a324c7e0 | ||
|
|
5712c1f59d | ||
|
|
490a2cd64e | ||
|
|
b8a3d8f380 | ||
|
|
855c450a97 | ||
|
|
2521c58c73 | ||
|
|
8df746e9d1 | ||
|
|
2945e94e3c | ||
|
|
083cc4af56 | ||
|
|
5cab56cc92 | ||
|
|
d8ad679e2c | ||
|
|
f2975a5e5e | ||
|
|
58789bfec7 | ||
|
|
e7e519bad2 | ||
|
|
f7111b5903 | ||
|
|
42b2dba589 | ||
|
|
2a1157a706 | ||
|
|
3394ebb9a5 | ||
|
|
b4fc6a9d72 | ||
|
|
feb4b89461 |
152 changed files with 18040 additions and 11763 deletions
5
.eslintignore
Normal file
5
.eslintignore
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.git
|
||||
packages/docsify-server-renderer/build.js
|
||||
node_modules
|
||||
build
|
||||
server.js
|
||||
18
.eslintrc
18
.eslintrc
|
|
@ -1,10 +1,20 @@
|
|||
{
|
||||
"extends": ["vue"],
|
||||
"env": {
|
||||
"browser": true
|
||||
"extends": "xo-space/browser",
|
||||
"rules": {
|
||||
"semi": [2, "never"],
|
||||
"no-return-assign": "off",
|
||||
"no-unused-expressions": "off",
|
||||
"no-new-func": "off",
|
||||
"no-multi-assign": "off",
|
||||
"no-mixed-operators": "off",
|
||||
"max-params": "off",
|
||||
"no-script-url": "off",
|
||||
"camelcase": "off",
|
||||
"no-warning-comments": "off"
|
||||
},
|
||||
"globals": {
|
||||
"Docsify": true,
|
||||
"$docsify": true
|
||||
"$docsify": true,
|
||||
"process": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
<!-- Please don't delete this template or we'll close your issue -->
|
||||
<!-- Please use English language -->
|
||||
<!-- Before creating an issue please make sure you are using the latest version of Docsify. -->
|
||||
<!-- Please ask questions on StackOverflow: https://stackoverflow.com/questions/ask?tags=docsify -->
|
||||
|
||||
## Bug Report
|
||||
|
||||
#### Steps to reproduce
|
||||
|
||||
|
||||
|
||||
#### What is current behaviour
|
||||
|
||||
|
||||
|
||||
#### What is the expected behaviour
|
||||
|
||||
|
||||
|
||||
#### Other relevant information
|
||||
|
||||
<!-- (Update "[ ]" to "[x]" to check a box) -->
|
||||
- [ ] Bug does still occur when all/other plugins are disabled?
|
||||
|
||||
- Your OS:
|
||||
- Node.js version:
|
||||
- npm/yarn version:
|
||||
- Browser version:
|
||||
- Docsify version:
|
||||
- Docsify plugins:
|
||||
|
||||
<!-- Love docsify? Please consider supporting our collective:
|
||||
👉 https://opencollective.com/docsify/donate -->
|
||||
25
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
<!-- Please don't delete this template or we'll close your issue -->
|
||||
<!-- Please use English language -->
|
||||
<!-- Before creating an issue please make sure you are using the latest version of Docsify. -->
|
||||
<!-- Please ask questions on StackOverflow 👉 https://stackoverflow.com/questions/ask?tags=docsify -->
|
||||
|
||||
## Feature request
|
||||
|
||||
#### What problem does this feature solve?
|
||||
|
||||
|
||||
|
||||
#### What does the proposed API look like?
|
||||
|
||||
|
||||
|
||||
#### How should this be implemented in your opinion?
|
||||
|
||||
|
||||
|
||||
#### Are you willing to work on this yourself?
|
||||
54
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
54
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<!-- Please use English language -->
|
||||
<!-- Please don't delete this template -->
|
||||
|
||||
<!-- PULL REQUEST TEMPLATE -->
|
||||
<!-- (Update "[ ]" to "[x]" to check a box) -->
|
||||
|
||||
**Summary**
|
||||
|
||||
**What kind of change does this PR introduce?** (check at least one)
|
||||
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Code style update
|
||||
- [ ] Refactor
|
||||
- [ ] Docs
|
||||
- [ ] Build-related changes
|
||||
- [ ] Other, please describe:
|
||||
|
||||
If changing the UI of default theme, please provide the **before/after** screenshot:
|
||||
|
||||
**Does this PR introduce a breaking change?** (check one)
|
||||
|
||||
- [ ] Yes
|
||||
- [ ] No
|
||||
|
||||
If yes, please describe the impact and migration path for existing applications:
|
||||
|
||||
**The PR fulfills these requirements:**
|
||||
|
||||
- [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. `fix #xxx[,#xxx]`, where "xxx" is the issue number)
|
||||
|
||||
You have tested in the following browsers: (Providing a detailed version will be better.)
|
||||
|
||||
- [ ] Chrome
|
||||
- [ ] Firefox
|
||||
- [ ] Safari
|
||||
- [ ] Edge
|
||||
- [ ] IE
|
||||
|
||||
If adding a **new feature**, the PR's description includes:
|
||||
|
||||
- [ ] A convincing reason for adding this feature
|
||||
- [ ] Related documents have been updated
|
||||
- [ ] Related tests have been updated
|
||||
|
||||
To avoid wasting your time, it's best to open a **feature request issue** first and wait for approval before working on it.
|
||||
|
||||
|
||||
**Other information:**
|
||||
|
||||
---
|
||||
|
||||
* [ ] DO NOT include files inside `lib` directory.
|
||||
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -1,4 +1,9 @@
|
|||
.DS_Store
|
||||
*.log
|
||||
.DS_Store
|
||||
.idea
|
||||
node_modules
|
||||
/themes
|
||||
themes/
|
||||
lib/
|
||||
|
||||
# exceptions
|
||||
!.gitkeep
|
||||
5
.npmignore
Normal file
5
.npmignore
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.eslintignore
|
||||
.eslintrc
|
||||
.github/
|
||||
.gitignore
|
||||
.travis.yml
|
||||
|
|
@ -1,6 +1,3 @@
|
|||
sudo: false
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.yarn-cache
|
||||
language: node_js
|
||||
node_js: stable
|
||||
|
|
|
|||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"prettier.eslintIntegration": true
|
||||
}
|
||||
769
CHANGELOG.md
769
CHANGELOG.md
|
|
@ -1,38 +1,753 @@
|
|||
<a name="4.9.4"></a>
|
||||
## [4.9.4](https://github.com/docsifyjs/docsify/compare/v4.9.2...v4.9.4) (2019-05-05)
|
||||
|
||||
3.0.4 / 2017-02-20
|
||||
==================
|
||||
|
||||
* fix(render): execute script
|
||||
* fix(render): disable rendering sub list when loadSidebar is false
|
||||
|
||||
3.0.3 / 2017-02-19
|
||||
==================
|
||||
<a name="4.9.2"></a>
|
||||
## [4.9.2](https://github.com/docsifyjs/docsify/compare/v4.9.1...v4.9.2) (2019-04-21)
|
||||
|
||||
* fixed look of links in blockquote
|
||||
* fix(scroll) highlight bug
|
||||
|
||||
3.0.2 / 2017-02-19
|
||||
==================
|
||||
### Bug Fixes
|
||||
|
||||
* fix(search): add lazy input
|
||||
* fix(compiler): link
|
||||
* re-render gitalk when router changed ([11ea1f8](https://github.com/docsifyjs/docsify/commit/11ea1f8))
|
||||
|
||||
3.0.1 / 2017-02-19
|
||||
==================
|
||||
|
||||
* fix(route): empty alias
|
||||
### Features
|
||||
|
||||
3.0.0 / 2017-02-19
|
||||
==================
|
||||
* allows relative path, fixed [#590](https://github.com/docsifyjs/docsify/issues/590) ([31654f1](https://github.com/docsifyjs/docsify/commit/31654f1))
|
||||
|
||||
#### Breaking change
|
||||
- Not support IE9
|
||||
- The route becomes: `/#/page?id=slug`. The previous route will be redirected
|
||||
|
||||
#### Features
|
||||
- Faster rendering
|
||||
- Clearer source code
|
||||
- More powerful API
|
||||
- Auto header for each page [#78](https://github.com/QingWei-Li/docsify/issues/78)
|
||||
- Localization for search plugin [#80](https://github.com/QingWei-Li/docsify/issues/80)
|
||||
- Execute the script in markdown (see `executeScript`)
|
||||
|
||||
<a name="4.9.1"></a>
|
||||
## [4.9.1](https://github.com/docsifyjs/docsify/compare/v4.9.0...v4.9.1) (2019-02-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* github assets url ([#774](https://github.com/docsifyjs/docsify/issues/774)) ([140bf10](https://github.com/docsifyjs/docsify/commit/140bf10))
|
||||
|
||||
|
||||
|
||||
<a name="4.9.0"></a>
|
||||
# [4.9.0](https://github.com/docsifyjs/docsify/compare/v4.8.6...v4.9.0) (2019-02-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* task list rendering (Fix [#749](https://github.com/docsifyjs/docsify/issues/749)) ([#757](https://github.com/docsifyjs/docsify/issues/757)) ([69ef489](https://github.com/docsifyjs/docsify/commit/69ef489))
|
||||
* upgrade npm-run-all ([049726e](https://github.com/docsifyjs/docsify/commit/049726e))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **search-plugin:** add namespace option ([#706](https://github.com/docsifyjs/docsify/issues/706)) ([28beff8](https://github.com/docsifyjs/docsify/commit/28beff8))
|
||||
* Add new theme "dolphin" ([#735](https://github.com/docsifyjs/docsify/issues/735)) ([c3345ba](https://github.com/docsifyjs/docsify/commit/c3345ba))
|
||||
* Provide code fragments feature ([#748](https://github.com/docsifyjs/docsify/issues/748)) ([1447c8a](https://github.com/docsifyjs/docsify/commit/1447c8a))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.6"></a>
|
||||
## [4.8.6](https://github.com/docsifyjs/docsify/compare/v4.8.5...v4.8.6) (2018-11-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* IE10 compatibility ([#691](https://github.com/docsifyjs/docsify/issues/691)) ([4db8cd6](https://github.com/docsifyjs/docsify/commit/4db8cd6))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.5"></a>
|
||||
## [4.8.5](https://github.com/docsifyjs/docsify/compare/v4.8.4...v4.8.5) (2018-11-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* expose version info for Docsify, fixed [#641](https://github.com/docsifyjs/docsify/issues/641) ([aa719e3](https://github.com/docsifyjs/docsify/commit/aa719e3))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.4"></a>
|
||||
## [4.8.4](https://github.com/docsifyjs/docsify/compare/v4.8.3...v4.8.4) (2018-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **cover:** Compatible with legacy styles, fixed [#677](https://github.com/docsifyjs/docsify/issues/677) ([#678](https://github.com/docsifyjs/docsify/issues/678)) ([1a945d4](https://github.com/docsifyjs/docsify/commit/1a945d4))
|
||||
|
||||
|
||||
|
||||
<a name="4.8.3"></a>
|
||||
|
||||
## [4.8.3](https://github.com/docsifyjs/docsify/compare/v4.8.2...v4.8.3) (2018-11-01)
|
||||
|
||||
Fix the last release files has the old version marked...
|
||||
|
||||
<a name="4.8.2"></a>
|
||||
|
||||
## [4.8.2](https://github.com/docsifyjs/docsify/compare/v4.8.1...v4.8.2) (2018-11-01)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- cover button style, fixed [#670](https://github.com/docsifyjs/docsify/issues/670), fixed [#665](https://github.com/docsifyjs/docsify/issues/665) ([#675](https://github.com/docsifyjs/docsify/issues/675)) ([fcd1087](https://github.com/docsifyjs/docsify/commit/fcd1087))
|
||||
- update match regex ([#669](https://github.com/docsifyjs/docsify/issues/669)) ([2edf47e](https://github.com/docsifyjs/docsify/commit/2edf47e))
|
||||
- use copy of cached value ([#668](https://github.com/docsifyjs/docsify/issues/668)) ([5fcf210](https://github.com/docsifyjs/docsify/commit/5fcf210))
|
||||
- **compiler:** import prism-markup-templating, fixed [#672](https://github.com/docsifyjs/docsify/issues/672) ([#676](https://github.com/docsifyjs/docsify/issues/676)) ([fdd8826](https://github.com/docsifyjs/docsify/commit/fdd8826))
|
||||
|
||||
### Features
|
||||
|
||||
- add heading config id ([#671](https://github.com/docsifyjs/docsify/issues/671)) ([ab19b13](https://github.com/docsifyjs/docsify/commit/ab19b13))
|
||||
|
||||
<a name="4.8.1"></a>
|
||||
|
||||
## [4.8.1](https://github.com/docsifyjs/docsify/compare/v4.8.0...v4.8.1) (2018-10-31)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- ssr package dep, fixed [#605](https://github.com/docsifyjs/docsify/issues/605) ([2bc880d](https://github.com/docsifyjs/docsify/commit/2bc880d))
|
||||
- **compiler:** extra quotes for codeblock ([4f588e0](https://github.com/docsifyjs/docsify/commit/4f588e0))
|
||||
- **compiler:** prevent render of html code in paragraph, fixed [#663](https://github.com/docsifyjs/docsify/issues/663) ([d35059d](https://github.com/docsifyjs/docsify/commit/d35059d))
|
||||
|
||||
### Features
|
||||
|
||||
- upgrade PrismJS, fixed [#534](https://github.com/docsifyjs/docsify/issues/534) ([4805cb5](https://github.com/docsifyjs/docsify/commit/4805cb5))
|
||||
|
||||
<a name="4.8.0"></a>
|
||||
|
||||
# [4.8.0](https://github.com/docsifyjs/docsify/compare/v4.7.1...v4.8.0) (2018-10-31)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Cache TOC for later usage in the case of cached file html ([#649](https://github.com/docsifyjs/docsify/issues/649)) ([9e86017](https://github.com/docsifyjs/docsify/commit/9e86017))
|
||||
- improve external script plugin ([#632](https://github.com/docsifyjs/docsify/issues/632)) ([50c2434](https://github.com/docsifyjs/docsify/commit/50c2434))
|
||||
- missing variable declaration ([#660](https://github.com/docsifyjs/docsify/issues/660)) ([1ce37bd](https://github.com/docsifyjs/docsify/commit/1ce37bd))
|
||||
- Remove target for mailto links ([#652](https://github.com/docsifyjs/docsify/issues/652)) ([18f0f03](https://github.com/docsifyjs/docsify/commit/18f0f03))
|
||||
- Update getAllPath query selector ([#653](https://github.com/docsifyjs/docsify/issues/653)) ([f6f4e32](https://github.com/docsifyjs/docsify/commit/f6f4e32))
|
||||
- Update vue.styl ([#634](https://github.com/docsifyjs/docsify/issues/634)) ([bf060be](https://github.com/docsifyjs/docsify/commit/bf060be))
|
||||
|
||||
### Features
|
||||
|
||||
- Add docsify version to $window.docsify object ([#641](https://github.com/docsifyjs/docsify/issues/641)) ([94bc415](https://github.com/docsifyjs/docsify/commit/94bc415)), closes [#521](https://github.com/docsifyjs/docsify/issues/521)
|
||||
- **compiler:** support embedded mermaid ([#629](https://github.com/docsifyjs/docsify/issues/629)) ([42ea8af](https://github.com/docsifyjs/docsify/commit/42ea8af))
|
||||
- Add hideOtherSidebarContent option ([#661](https://github.com/docsifyjs/docsify/issues/661)) ([4a23c4a](https://github.com/docsifyjs/docsify/commit/4a23c4a))
|
||||
- Allow base64, external, and relative logo values ([#642](https://github.com/docsifyjs/docsify/issues/642)) ([0a0802a](https://github.com/docsifyjs/docsify/commit/0a0802a)), closes [#577](https://github.com/docsifyjs/docsify/issues/577)
|
||||
- upgrade marked to 0.5.x, fixed [#645](https://github.com/docsifyjs/docsify/issues/645), close [#644](https://github.com/docsifyjs/docsify/issues/644) ([#662](https://github.com/docsifyjs/docsify/issues/662)) ([a39b214](https://github.com/docsifyjs/docsify/commit/a39b214))
|
||||
|
||||
<a name="4.7.1"></a>
|
||||
|
||||
## [4.7.1](https://github.com/docsifyjs/docsify/compare/v4.7.0...v4.7.1) (2018-08-30)
|
||||
|
||||
<a name="4.7.0"></a>
|
||||
|
||||
# [4.7.0](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.7.0) (2018-06-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- alldow addition content in sidebar, fix [#518](https://github.com/QingWei-Li/docsify/issues/518), fix 539 ([#543](https://github.com/QingWei-Li/docsify/issues/543)) ([04b36b0](https://github.com/QingWei-Li/docsify/commit/04b36b0))
|
||||
- async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c))
|
||||
- loading embed files synchronously, fixed [#525](https://github.com/QingWei-Li/docsify/issues/525), fixed [#527](https://github.com/QingWei-Li/docsify/issues/527) ([#544](https://github.com/QingWei-Li/docsify/issues/544)) ([feea7f9](https://github.com/QingWei-Li/docsify/commit/feea7f9))
|
||||
- path include chinese character cause hilight bug ([#556](https://github.com/QingWei-Li/docsify/issues/556)) ([a5f333a](https://github.com/QingWei-Li/docsify/commit/a5f333a))
|
||||
|
||||
### Features
|
||||
|
||||
- add logo option, [#264](https://github.com/QingWei-Li/docsify/issues/264) ([#541](https://github.com/QingWei-Li/docsify/issues/541)) ([ee72dd0](https://github.com/QingWei-Li/docsify/commit/ee72dd0))
|
||||
- add unpkg field, close [#531](https://github.com/QingWei-Li/docsify/issues/531) ([#558](https://github.com/QingWei-Li/docsify/issues/558)) ([5c0de0a](https://github.com/QingWei-Li/docsify/commit/5c0de0a))
|
||||
- support image resizing, resolve [#508](https://github.com/QingWei-Li/docsify/issues/508) ([#545](https://github.com/QingWei-Li/docsify/issues/545)) ([3a7ad62](https://github.com/QingWei-Li/docsify/commit/3a7ad62))
|
||||
|
||||
<a name="4.6.10"></a>
|
||||
|
||||
## [4.6.10](https://github.com/QingWei-Li/docsify/compare/v4.6.9...v4.6.10) (2018-03-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- async install config, fixed [#425](https://github.com/QingWei-Li/docsify/issues/425) ([e4e011c](https://github.com/QingWei-Li/docsify/commit/e4e011c))
|
||||
|
||||
<a name="4.6.9"></a>
|
||||
|
||||
## [4.6.9](https://github.com/QingWei-Li/docsify/compare/v4.6.8...v4.6.9) (2018-03-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- upgrade medium-zoom, fixed [#417](https://github.com/QingWei-Li/docsify/issues/417) ([6a3d69a](https://github.com/QingWei-Li/docsify/commit/6a3d69a))
|
||||
|
||||
<a name="4.6.8"></a>
|
||||
|
||||
## [4.6.8](https://github.com/QingWei-Li/docsify/compare/v4.6.7...v4.6.8) (2018-03-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- resolve path of image and embed files, fixed [#412](https://github.com/QingWei-Li/docsify/issues/412) ([bfd0d18](https://github.com/QingWei-Li/docsify/commit/bfd0d18))
|
||||
|
||||
<a name="4.6.7"></a>
|
||||
|
||||
## [4.6.7](https://github.com/QingWei-Li/docsify/compare/v4.6.6...v4.6.7) (2018-03-03)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- layout css, fixed [#409](https://github.com/QingWei-Li/docsify/issues/409) ([aeb692e](https://github.com/QingWei-Li/docsify/commit/aeb692e))
|
||||
|
||||
<a name="4.6.6"></a>
|
||||
|
||||
## [4.6.6](https://github.com/QingWei-Li/docsify/compare/v4.6.5...v4.6.6) (2018-03-03)
|
||||
|
||||
<a name="4.6.5"></a>
|
||||
|
||||
## [4.6.5](https://github.com/QingWei-Li/docsify/compare/v4.6.4...v4.6.5) (2018-03-03)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **navbar:** Now Navbar isn't append to DOM when loadNavbar is falsy ([#407](https://github.com/QingWei-Li/docsify/issues/407)) ([0933445](https://github.com/QingWei-Li/docsify/commit/0933445))
|
||||
|
||||
### Features
|
||||
|
||||
- **config:** Add 404 page options. ([#406](https://github.com/QingWei-Li/docsify/issues/406)) ([9b3b445](https://github.com/QingWei-Li/docsify/commit/9b3b445))
|
||||
|
||||
<a name="4.6.4"></a>
|
||||
|
||||
## [4.6.4](https://github.com/QingWei-Li/docsify/compare/v4.6.3...v4.6.4) (2018-03-01)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **render:** Disable markdown parsing when the file is an HTML ([#403](https://github.com/QingWei-Li/docsify/issues/403)) ([278a75e](https://github.com/QingWei-Li/docsify/commit/278a75e))
|
||||
|
||||
### Features
|
||||
|
||||
- **fetch:** Add fallback languages configuration. ([#402](https://github.com/QingWei-Li/docsify/issues/402)) ([ecc0e04](https://github.com/QingWei-Li/docsify/commit/ecc0e04))
|
||||
|
||||
<a name="4.6.3"></a>
|
||||
|
||||
## [4.6.3](https://github.com/QingWei-Li/docsify/compare/v4.6.2...v4.6.3) (2018-02-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **hook:** beforeEach don\'t work, fixed [#393](https://github.com/QingWei-Li/docsify/issues/393) ([6a09059](https://github.com/QingWei-Li/docsify/commit/6a09059))
|
||||
|
||||
<a name="4.6.2"></a>
|
||||
|
||||
## [4.6.2](https://github.com/QingWei-Li/docsify/compare/v4.6.1...v4.6.2) (2018-02-14)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **embed:** broken in IE, fixed [#389](https://github.com/QingWei-Li/docsify/issues/389), fixed [#391](https://github.com/QingWei-Li/docsify/issues/391) ([45a7464](https://github.com/QingWei-Li/docsify/commit/45a7464))
|
||||
- **embed:** init value ([890a7bf](https://github.com/QingWei-Li/docsify/commit/890a7bf))
|
||||
|
||||
<a name="4.6.1"></a>
|
||||
|
||||
## [4.6.1](https://github.com/QingWei-Li/docsify/compare/v4.6.0...v4.6.1) (2018-02-12)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **embed** compatible ssr ([dc0c3ce](https://github.com/QingWei-Li/docsify/commit/dc0c3ce))
|
||||
- **embed** async fetch embed files, fixed [#387](https://github.com/QingWei-Li/docsify/issues/387)
|
||||
|
||||
<a name="4.6.0"></a>
|
||||
|
||||
# [4.6.0](https://github.com/QingWei-Li/docsify/compare/v4.5.9...v4.6.0) (2018-02-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **search:** custom clear button, fixed [#271](https://github.com/QingWei-Li/docsify/issues/271) ([864aa18](https://github.com/QingWei-Li/docsify/commit/864aa18))
|
||||
- **search:** escape special characters for search, fixed [#369](https://github.com/QingWei-Li/docsify/issues/369) ([9755439](https://github.com/QingWei-Li/docsify/commit/9755439))
|
||||
- build config ([342438f](https://github.com/QingWei-Li/docsify/commit/342438f))
|
||||
- button style for coverpage, fixed [#362](https://github.com/QingWei-Li/docsify/issues/362) ([85428ef](https://github.com/QingWei-Li/docsify/commit/85428ef))
|
||||
- dropdown scroll style, fixed [#346](https://github.com/QingWei-Li/docsify/issues/346) ([c4d83f2](https://github.com/QingWei-Li/docsify/commit/c4d83f2))
|
||||
- highlight homepage link, fixed [#304](https://github.com/QingWei-Li/docsify/issues/304) ([f960c19](https://github.com/QingWei-Li/docsify/commit/f960c19))
|
||||
- homepage link ([e097f88](https://github.com/QingWei-Li/docsify/commit/e097f88))
|
||||
- onlyCover ([033be4f](https://github.com/QingWei-Li/docsify/commit/033be4f))
|
||||
- ssr compatible embedd ([ebc10c4](https://github.com/QingWei-Li/docsify/commit/ebc10c4))
|
||||
- ssr coverpage, fixed [#273](https://github.com/QingWei-Li/docsify/issues/273) ([9e824a4](https://github.com/QingWei-Li/docsify/commit/9e824a4))
|
||||
|
||||
### Features
|
||||
|
||||
- click sidebar menu add collapse and expand, close [#294](https://github.com/QingWei-Li/docsify/issues/294) ([5e161a1](https://github.com/QingWei-Li/docsify/commit/5e161a1))
|
||||
- **compiler:** support embedded file as code block, close [#134](https://github.com/QingWei-Li/docsify/issues/134) ([761ccc2](https://github.com/QingWei-Li/docsify/commit/761ccc2))
|
||||
- **compiler:** support embedded markdown, html, video, etc files, close [#383](https://github.com/QingWei-Li/docsify/issues/383), close [#333](https://github.com/QingWei-Li/docsify/issues/333) ([524f52f](https://github.com/QingWei-Li/docsify/commit/524f52f))
|
||||
- **cover:** add onlyCover option, close [#382](https://github.com/QingWei-Li/docsify/issues/382) ([b265fdd](https://github.com/QingWei-Li/docsify/commit/b265fdd))
|
||||
- **fetch:** add requestHeaders option, fixed [#336](https://github.com/QingWei-Li/docsify/issues/336) ([54ab4c9](https://github.com/QingWei-Li/docsify/commit/54ab4c9))
|
||||
- **render:** add ext option for custom file extenstion, close [#340](https://github.com/QingWei-Li/docsify/issues/340) ([248aa72](https://github.com/QingWei-Li/docsify/commit/248aa72))
|
||||
- **render:** mutilple coverpage, close [#315](https://github.com/QingWei-Li/docsify/issues/315) ([f68ddf5](https://github.com/QingWei-Li/docsify/commit/f68ddf5))
|
||||
|
||||
<a name="4.5.9"></a>
|
||||
|
||||
## [4.5.9](https://github.com/QingWei-Li/docsify/compare/v4.5.8...v4.5.9) (2018-02-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- upgrade marked ([4157173](https://github.com/QingWei-Li/docsify/commit/4157173))
|
||||
|
||||
<a name="4.5.8"></a>
|
||||
|
||||
## [4.5.8](https://github.com/QingWei-Li/docsify/compare/v4.5.6...v4.5.8) (2018-02-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- cover style, fixed [#381](https://github.com/QingWei-Li/docsify/issues/381) ([368754e](https://github.com/QingWei-Li/docsify/commit/368754e))
|
||||
- updated deps ([#337](https://github.com/QingWei-Li/docsify/issues/337)) ([a12d393](https://github.com/QingWei-Li/docsify/commit/a12d393))
|
||||
|
||||
<a name="4.5.7"></a>
|
||||
|
||||
## [4.5.7](https://github.com/QingWei-Li/docsify/compare/v4.5.6...v4.5.7) (2017-12-29)
|
||||
|
||||
### Features
|
||||
|
||||
- add navigation plugin, closed [#180](https://github.com/QingWei-Li/docsify/issues/180) ([f78be4c](https://github.com/QingWei-Li/docsify/commit/f78be4c))
|
||||
|
||||
<a name="4.5.6"></a>
|
||||
|
||||
## [4.5.6](https://github.com/QingWei-Li/docsify/compare/v4.5.3...v4.5.6) (2017-12-14)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **style:** increase the tap targets of menu button, fixed [#325](https://github.com/QingWei-Li/docsify/issues/325) ([888f217](https://github.com/QingWei-Li/docsify/commit/888f217))
|
||||
|
||||
<a name="4.5.5"></a>
|
||||
|
||||
## [4.5.5](https://github.com/QingWei-Li/docsify/compare/v4.5.4...v4.5.5) (2017-11-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- disqus plugin issue ([#318](https://github.com/QingWei-Li/docsify/issues/318)) ([041b33e](https://github.com/QingWei-Li/docsify/commit/041b33e)), closes [#317](https://github.com/QingWei-Li/docsify/issues/317)
|
||||
|
||||
<a name="4.5.4"></a>
|
||||
|
||||
## [4.5.4](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.4) (2017-11-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **compiler:** task lists style, fixed [#215](https://github.com/QingWei-Li/docsify/issues/215) ([e43ded4](https://github.com/QingWei-Li/docsify/commit/e43ded4))
|
||||
|
||||
### Features
|
||||
|
||||
- add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
|
||||
|
||||
<a name="4.5.3"></a>
|
||||
|
||||
## [4.5.3](https://github.com/QingWei-Li/docsify/compare/v4.5.2...v4.5.3) (2017-11-11)
|
||||
|
||||
### Features
|
||||
|
||||
- add gitalk plugin ([#306](https://github.com/QingWei-Li/docsify/issues/306)) ([9208e64](https://github.com/QingWei-Li/docsify/commit/9208e64))
|
||||
|
||||
<a name="4.5.2"></a>
|
||||
|
||||
## [4.5.2](https://github.com/QingWei-Li/docsify/compare/v4.5.1...v4.5.2) (2017-11-09)
|
||||
|
||||
### Features
|
||||
|
||||
- github task lists, close [#215](https://github.com/QingWei-Li/docsify/issues/215) ([#305](https://github.com/QingWei-Li/docsify/issues/305)) ([d486eef](https://github.com/QingWei-Li/docsify/commit/d486eef))
|
||||
|
||||
<a name="4.5.1"></a>
|
||||
|
||||
## [4.5.1](https://github.com/QingWei-Li/docsify/compare/v4.5.0...v4.5.1) (2017-11-07)
|
||||
|
||||
### Features
|
||||
|
||||
- fetch files with the query params, fixed [#303](https://github.com/QingWei-Li/docsify/issues/303) ([2a2ed96](https://github.com/QingWei-Li/docsify/commit/2a2ed96))
|
||||
|
||||
<a name="4.5.0"></a>
|
||||
|
||||
# [4.5.0](https://github.com/QingWei-Li/docsify/compare/v4.4.1...v4.5.0) (2017-11-04)
|
||||
|
||||
### Features
|
||||
|
||||
- add disqus plugin, closed [#123](https://github.com/QingWei-Li/docsify/issues/123) ([fd7d4e0](https://github.com/QingWei-Li/docsify/commit/fd7d4e0))
|
||||
|
||||
<a name="4.4.1"></a>
|
||||
|
||||
## [4.4.1](https://github.com/QingWei-Li/docsify/compare/v4.4.0...v4.4.1) (2017-10-31)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- {docsify-ignore-all} and {docsify-ignore} bug ([#299](https://github.com/QingWei-Li/docsify/issues/299)) ([cc98f56](https://github.com/QingWei-Li/docsify/commit/cc98f56))
|
||||
- zoom image plugin issue, fixed [#187](https://github.com/QingWei-Li/docsify/issues/187) ([#300](https://github.com/QingWei-Li/docsify/issues/300)) ([fa772cf](https://github.com/QingWei-Li/docsify/commit/fa772cf))
|
||||
|
||||
<a name="4.4.0"></a>
|
||||
|
||||
# [4.4.0](https://github.com/QingWei-Li/docsify/compare/v4.3.15...v4.4.0) (2017-10-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- sidebar style issue on firefox, fixed [#184](https://github.com/QingWei-Li/docsify/issues/184) ([#297](https://github.com/QingWei-Li/docsify/issues/297)) ([36bfc9d](https://github.com/QingWei-Li/docsify/commit/36bfc9d))
|
||||
|
||||
### Features
|
||||
|
||||
- add helper for disabled link, fixed [#295](https://github.com/QingWei-Li/docsify/issues/295) ([#296](https://github.com/QingWei-Li/docsify/issues/296)) ([4ad96f3](https://github.com/QingWei-Li/docsify/commit/4ad96f3))
|
||||
|
||||
<a name="4.3.15"></a>
|
||||
|
||||
## [4.3.15](https://github.com/QingWei-Li/docsify/compare/v4.3.14...v4.3.15) (2017-10-20)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- scroll active sidebar ([a2b8eae](https://github.com/QingWei-Li/docsify/commit/a2b8eae))
|
||||
|
||||
<a name="4.3.14"></a>
|
||||
|
||||
## [4.3.14](https://github.com/QingWei-Li/docsify/compare/v4.3.13...v4.3.14) (2017-10-20)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- codesponsor style ([ab68268](https://github.com/QingWei-Li/docsify/commit/ab68268))
|
||||
|
||||
<a name="4.3.13"></a>
|
||||
|
||||
## [4.3.13](https://github.com/QingWei-Li/docsify/compare/v4.3.12...v4.3.13) (2017-10-17)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- duplicate results in search fixed [#257](https://github.com/QingWei-Li/docsify/issues/257) ([#284](https://github.com/QingWei-Li/docsify/issues/284)) ([3476f6f](https://github.com/QingWei-Li/docsify/commit/3476f6f))
|
||||
|
||||
### Features
|
||||
|
||||
- make whole search result clickable ([#285](https://github.com/QingWei-Li/docsify/issues/285)) ([1b91227](https://github.com/QingWei-Li/docsify/commit/1b91227))
|
||||
|
||||
<a name="4.3.12"></a>
|
||||
|
||||
## [4.3.12](https://github.com/QingWei-Li/docsify/compare/v4.3.11...v4.3.12) (2017-10-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- incorrect active link ([#281](https://github.com/QingWei-Li/docsify/issues/281)) ([a3ab379](https://github.com/QingWei-Li/docsify/commit/a3ab379))
|
||||
|
||||
<a name="4.3.11"></a>
|
||||
|
||||
## [4.3.11](https://github.com/QingWei-Li/docsify/compare/v4.3.10...v4.3.11) (2017-10-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- broken links to same page heading, fix [#278](https://github.com/QingWei-Li/docsify/issues/278), fix [#279](https://github.com/QingWei-Li/docsify/issues/279) ([91d6337](https://github.com/QingWei-Li/docsify/commit/91d6337))
|
||||
|
||||
<a name="4.3.10"></a>
|
||||
|
||||
## [4.3.10](https://github.com/QingWei-Li/docsify/compare/v4.3.9...v4.3.10) (2017-10-12)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- link render issue after page refreshing ([#276](https://github.com/QingWei-Li/docsify/issues/276)) ([abd885e](https://github.com/QingWei-Li/docsify/commit/abd885e))
|
||||
|
||||
<a name="4.3.9"></a>
|
||||
|
||||
## [4.3.9](https://github.com/QingWei-Li/docsify/compare/v4.3.8...v4.3.9) (2017-10-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- scroll issue in IE ([#275](https://github.com/QingWei-Li/docsify/issues/275)) ([3e94cb6](https://github.com/QingWei-Li/docsify/commit/3e94cb6))
|
||||
|
||||
<a name="4.3.8"></a>
|
||||
|
||||
## [4.3.8](https://github.com/QingWei-Li/docsify/compare/v4.3.7...v4.3.8) (2017-10-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **slugify:** GitHub compatible heading links, fixed [#272](https://github.com/QingWei-Li/docsify/issues/272) ([9b4e666](https://github.com/QingWei-Li/docsify/commit/9b4e666))
|
||||
|
||||
<a name="4.3.7"></a>
|
||||
|
||||
## [4.3.7](https://github.com/QingWei-Li/docsify/compare/v4.3.6...v4.3.7) (2017-10-02)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **slugify:** GitHub compatible heading links, fixed [#267](https://github.com/QingWei-Li/docsify/issues/267) ([c195d2d](https://github.com/QingWei-Li/docsify/commit/c195d2d))
|
||||
|
||||
<a name="4.3.6"></a>
|
||||
|
||||
## [4.3.6](https://github.com/QingWei-Li/docsify/compare/v4.3.5...v4.3.6) (2017-09-21)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- style for codesponsor plugin ([08afec7](https://github.com/QingWei-Li/docsify/commit/08afec7))
|
||||
|
||||
<a name="4.3.5"></a>
|
||||
|
||||
## [4.3.5](https://github.com/QingWei-Li/docsify/compare/v4.3.4...v4.3.5) (2017-09-20)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- missed symbol ([#254](https://github.com/QingWei-Li/docsify/issues/254)) ([6c702d3](https://github.com/QingWei-Li/docsify/commit/6c702d3))
|
||||
|
||||
### Features
|
||||
|
||||
- **plugin:** add codesponsor plugin ([46ac4c3](https://github.com/QingWei-Li/docsify/commit/46ac4c3))
|
||||
|
||||
<a name="4.3.4"></a>
|
||||
|
||||
## [4.3.4](https://github.com/QingWei-Li/docsify/compare/v4.3.3...v4.3.4) (2017-09-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- scroll position issue, fixed [#234](https://github.com/QingWei-Li/docsify/issues/234) ([388ed3d](https://github.com/QingWei-Li/docsify/commit/388ed3d))
|
||||
|
||||
<a name="4.3.3"></a>
|
||||
|
||||
## [4.3.3](https://github.com/QingWei-Li/docsify/compare/v4.3.2...v4.3.3) (2017-09-06)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **buble.css:** tweaks code block style, fixed [#249](https://github.com/QingWei-Li/docsify/issues/249) ([9d43051](https://github.com/QingWei-Li/docsify/commit/9d43051))
|
||||
|
||||
### Features
|
||||
|
||||
- add doc for react and vue demo box plugin ([#247](https://github.com/QingWei-Li/docsify/issues/247)) ([f0aca19](https://github.com/QingWei-Li/docsify/commit/f0aca19))
|
||||
|
||||
<a name="4.3.2"></a>
|
||||
|
||||
## [4.3.2](https://github.com/QingWei-Li/docsify/compare/v4.3.1...v4.3.2) (2017-09-01)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- sidebar highlight ([f82f419](https://github.com/QingWei-Li/docsify/commit/f82f419))
|
||||
|
||||
### Features
|
||||
|
||||
- add Edit on github plugin (thanks [@njleonzhang](https://github.com/njleonzhang)) ([a0e1ea8](https://github.com/QingWei-Li/docsify/commit/a0e1ea8))
|
||||
|
||||
<a name="4.3.1"></a>
|
||||
|
||||
## [4.3.1](https://github.com/QingWei-Li/docsify/compare/v4.2.9...v4.3.1) (2017-08-30)
|
||||
|
||||
### Features
|
||||
|
||||
- **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0))
|
||||
|
||||
<a name="4.3.0"></a>
|
||||
|
||||
# [4.3.0](https://github.com/QingWei-Li/docsify/compare/v4.2.9...v4.3.0) (2017-08-17)
|
||||
|
||||
### Features
|
||||
|
||||
- **markdown:** supports mermaid [#137](https://github.com/QingWei-Li/docsify/issues/137) ([f4800e0](https://github.com/QingWei-Li/docsify/commit/f4800e0))
|
||||
|
||||
<a name="4.2.9"></a>
|
||||
|
||||
## [4.2.9](https://github.com/QingWei-Li/docsify/compare/v4.2.8...v4.2.9) (2017-08-15)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- ensure document ready before init Docsify [#233](https://github.com/QingWei-Li/docsify/issues/233)
|
||||
|
||||
<a name="4.2.8"></a>
|
||||
|
||||
## [4.2.8](https://github.com/QingWei-Li/docsify/compare/v4.2.7...v4.2.8) (2017-08-10)
|
||||
|
||||
### Features
|
||||
|
||||
- **compiler:** support for setting target attribute for link, fixed [#230](https://github.com/QingWei-Li/docsify/issues/230) ([7f270f9](https://github.com/QingWei-Li/docsify/commit/7f270f9))
|
||||
|
||||
<a name="4.2.7"></a>
|
||||
|
||||
## [4.2.7](https://github.com/QingWei-Li/docsify/compare/v4.2.4...v4.2.7) (2017-08-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211))
|
||||
- **style:** nowrap => pre-wrap, fixed [#228](https://github.com/QingWei-Li/docsify/issues/228) ([a88252c](https://github.com/QingWei-Li/docsify/commit/a88252c))
|
||||
|
||||
<a name="4.2.6"></a>
|
||||
|
||||
## [4.2.6](https://github.com/QingWei-Li/docsify/compare/v4.2.4...v4.2.6) (2017-07-27)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **css:** hide the nav when the content has not yet been loaded ([1fa1619](https://github.com/QingWei-Li/docsify/commit/1fa1619))
|
||||
- **release:** release shell ([628e211](https://github.com/QingWei-Li/docsify/commit/628e211))
|
||||
|
||||
<a name="4.2.4"></a>
|
||||
|
||||
## [4.2.4](https://github.com/QingWei-Li/docsify/compare/v4.2.2...v4.2.4) (2017-07-26)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **render:** Remove getRootNode to be compatible with the lower version of Chrome, fixed [#225](https://github.com/QingWei-Li/docsify/issues/225) ([b8dd346](https://github.com/QingWei-Li/docsify/commit/b8dd346))
|
||||
|
||||
<a name="4.2.3"></a>
|
||||
|
||||
## [4.2.3](https://github.com/QingWei-Li/docsify/compare/v4.2.2...v4.2.3) (2017-07-26)
|
||||
|
||||
### Features
|
||||
|
||||
- **search:** Supports the max depth of the search headline, fixed [#223](https://github.com/QingWei-Li/docsify/issues/223), resolve [#129](https://github.com/QingWei-Li/docsify/issues/129) ([b7b589b](https://github.com/QingWei-Li/docsify/commit/b7b589b))
|
||||
|
||||
<a name="4.2.2"></a>
|
||||
|
||||
## [4.2.2](https://github.com/QingWei-Li/docsify/compare/v4.2.1...v4.2.2) (2017-07-24)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- style rerender due to setting themeColor ([17ff3d1](https://github.com/QingWei-Li/docsify/commit/17ff3d1))
|
||||
|
||||
<a name="4.2.1"></a>
|
||||
|
||||
## [4.2.1](https://github.com/QingWei-Li/docsify/compare/v4.2.0...v4.2.1) (2017-07-19)
|
||||
|
||||
- give the navbar some line-height (#216)
|
||||
- Remove unnecessary moduleName option from rollup config for plugins (#209)
|
||||
|
||||
<a name="4.2.0"></a>
|
||||
|
||||
# [4.2.0](https://github.com/QingWei-Li/docsify/compare/v4.1.14...v4.2.0) (2017-07-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- not found page ([9af8559](https://github.com/QingWei-Li/docsify/commit/9af8559))
|
||||
|
||||
### Features
|
||||
|
||||
- alias option supports regexp, resolve [#183](https://github.com/QingWei-Li/docsify/issues/183) ([c4aa22c](https://github.com/QingWei-Li/docsify/commit/c4aa22c))
|
||||
- ignore to compiled link, fixed [#203](https://github.com/QingWei-Li/docsify/issues/203) ([#204](https://github.com/QingWei-Li/docsify/issues/204)) ([2e00f4c](https://github.com/QingWei-Li/docsify/commit/2e00f4c))
|
||||
|
||||
<a name="4.1.14"></a>
|
||||
|
||||
## [4.1.14](https://github.com/QingWei-Li/docsify/compare/v4.1.13...v4.1.14) (2017-06-24)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- get file path, fixed jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070 ([e8117e5](https://github.com/QingWei-Li/docsify/commit/e8117e5)), closes [jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13#commitcomment-22427070](https://github.com/jrappen/sublime-distractionless/commit/81bfadd391428823191cc03eca956a2312e04d13/issues/commitcomment-22427070)
|
||||
|
||||
### Features
|
||||
|
||||
- add context attribute, fixed [#191](https://github.com/QingWei-Li/docsify/issues/191) ([ce0e9ac](https://github.com/QingWei-Li/docsify/commit/ce0e9ac))
|
||||
|
||||
<a name="4.1.13"></a>
|
||||
|
||||
## [4.1.13](https://github.com/QingWei-Li/docsify/compare/v4.1.12...v4.1.13) (2017-06-11)
|
||||
|
||||
<a name="4.1.12"></a>
|
||||
|
||||
## [4.1.12](https://github.com/QingWei-Li/docsify/compare/v4.1.11...v4.1.12) (2017-06-03)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **render:** subtitle in side bar shows undefined, fixed [#182](https://github.com/QingWei-Li/docsify/issues/182) ([d087d57](https://github.com/QingWei-Li/docsify/commit/d087d57))
|
||||
|
||||
<a name="4.1.11"></a>
|
||||
|
||||
## [4.1.11](https://github.com/QingWei-Li/docsify/compare/v4.1.10...v4.1.11) (2017-06-02)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **compiler:** force reset toc when rendering sidebar fixed [#181](https://github.com/QingWei-Li/docsify/issues/181) ([ccf4c7c](https://github.com/QingWei-Li/docsify/commit/ccf4c7c))
|
||||
- **render:** autoHeader does not work ([1304d2e](https://github.com/QingWei-Li/docsify/commit/1304d2e))
|
||||
|
||||
<a name="4.1.10"></a>
|
||||
|
||||
## [4.1.10](https://github.com/QingWei-Li/docsify/compare/v4.1.9...v4.1.10) (2017-06-02)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **hash:** hash routing crashes when url has querystring ([6d48ce1](https://github.com/QingWei-Li/docsify/commit/6d48ce1))
|
||||
|
||||
<a name="4.1.9"></a>
|
||||
|
||||
## [4.1.9](https://github.com/QingWei-Li/docsify/compare/v4.1.8...v4.1.9) (2017-05-31)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- can't render toc on first load ([d9b487e](https://github.com/QingWei-Li/docsify/commit/d9b487e))
|
||||
- **lifecycle:** continue to handle data ([955d3d5](https://github.com/QingWei-Li/docsify/commit/955d3d5))
|
||||
- **render:** broken name link, fixed [#167](https://github.com/QingWei-Li/docsify/issues/167) ([91b66a5](https://github.com/QingWei-Li/docsify/commit/91b66a5))
|
||||
|
||||
<a name="4.1.8"></a>
|
||||
|
||||
## [4.1.8](https://github.com/QingWei-Li/docsify/compare/v4.1.7...v4.1.8) (2017-05-31)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- auto replace version ([22b50f0](https://github.com/QingWei-Li/docsify/commit/22b50f0))
|
||||
- update edit button demo ([ec887c1](https://github.com/QingWei-Li/docsify/commit/ec887c1))
|
||||
|
||||
### Features
|
||||
|
||||
- add edit button demo ([a64cee1](https://github.com/QingWei-Li/docsify/commit/a64cee1))
|
||||
- add edit button demo, close [#162](https://github.com/QingWei-Li/docsify/issues/162) ([036fdac](https://github.com/QingWei-Li/docsify/commit/036fdac))
|
||||
|
||||
<a name="4.1.7"></a>
|
||||
|
||||
## [4.1.7](https://github.com/QingWei-Li/docsify/compare/v4.1.6...v4.1.7) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **ssr:** clean files ([0014895](https://github.com/QingWei-Li/docsify/commit/0014895))
|
||||
|
||||
<a name="4.1.6"></a>
|
||||
|
||||
## [4.1.6](https://github.com/QingWei-Li/docsify/compare/v4.1.5...v4.1.6) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **ssr:** add debug ([6b9e092](https://github.com/QingWei-Li/docsify/commit/6b9e092))
|
||||
|
||||
<a name="4.1.5"></a>
|
||||
|
||||
## [4.1.5](https://github.com/QingWei-Li/docsify/compare/v4.1.4...v4.1.5) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **ssr:** missing package ([6db8c9e](https://github.com/QingWei-Li/docsify/commit/6db8c9e))
|
||||
|
||||
<a name="4.1.4"></a>
|
||||
|
||||
## [4.1.4](https://github.com/QingWei-Li/docsify/compare/v4.1.3...v4.1.4) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **ssr:** file path ([79a83bc](https://github.com/QingWei-Li/docsify/commit/79a83bc))
|
||||
|
||||
<a name="4.1.3"></a>
|
||||
|
||||
## [4.1.3](https://github.com/QingWei-Li/docsify/compare/v4.1.2...v4.1.3) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- update babel config ([9825db4](https://github.com/QingWei-Li/docsify/commit/9825db4))
|
||||
|
||||
<a name="4.1.2"></a>
|
||||
|
||||
## [4.1.2](https://github.com/QingWei-Li/docsify/compare/v4.1.1...v4.1.2) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- update babel config ([80dba19](https://github.com/QingWei-Li/docsify/commit/80dba19))
|
||||
|
||||
<a name="4.1.1"></a>
|
||||
|
||||
## [4.1.1](https://github.com/QingWei-Li/docsify/compare/v4.1.0...v4.1.1) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- build for ssr package ([4cb20a5](https://github.com/QingWei-Li/docsify/commit/4cb20a5))
|
||||
- remove history mode ([0e74e6c](https://github.com/QingWei-Li/docsify/commit/0e74e6c))
|
||||
|
||||
<a name="4.1.0"></a>
|
||||
|
||||
# [4.1.0](https://github.com/QingWei-Li/docsify/compare/v4.0.2...v4.1.0) (2017-05-30)
|
||||
|
||||
<a name="4.0.2"></a>
|
||||
|
||||
## [4.0.2](https://github.com/QingWei-Li/docsify/compare/v4.0.1...v4.0.2) (2017-05-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- basePath for history mode ([fc1cd3f](https://github.com/QingWei-Li/docsify/commit/fc1cd3f))
|
||||
|
||||
<a name="4.0.1"></a>
|
||||
|
||||
## [4.0.1](https://github.com/QingWei-Li/docsify/compare/v4.0.0...v4.0.1) (2017-05-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **ssr:** remove context ([4626157](https://github.com/QingWei-Li/docsify/commit/4626157))
|
||||
- lint ([b764b6e](https://github.com/QingWei-Li/docsify/commit/b764b6e))
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
|
||||
# [4.0.0](https://github.com/QingWei-Li/docsify/compare/v3.7.3...v4.0.0) (2017-05-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **render:** init event in ssr ([eba1c98](https://github.com/QingWei-Li/docsify/commit/eba1c98))
|
||||
- lint ([1f4514d](https://github.com/QingWei-Li/docsify/commit/1f4514d))
|
||||
|
||||
### Features
|
||||
|
||||
- finish ssr ([3444884](https://github.com/QingWei-Li/docsify/commit/3444884))
|
||||
- init ocsify-server-renderer ([6dea685](https://github.com/QingWei-Li/docsify/commit/6dea685))
|
||||
- support history mode ([f095eb8](https://github.com/QingWei-Li/docsify/commit/f095eb8))
|
||||
|
|
|
|||
67
CONTRIBUTING.md
Normal file
67
CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# Contribute
|
||||
|
||||
## Introduction
|
||||
|
||||
First, thank you for considering contributing to docsify! It's people like you that make the open source community such a great community! 😊
|
||||
|
||||
We welcome any type of contribution, not only code. You can help with
|
||||
- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
|
||||
- **Marketing**: writing blog posts, howto's, printing stickers, ...
|
||||
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
|
||||
- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
|
||||
- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify).
|
||||
|
||||
## Your First Contribution
|
||||
|
||||
Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
|
||||
|
||||
## Submitting code
|
||||
|
||||
Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.
|
||||
|
||||
## Code review process
|
||||
|
||||
The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.
|
||||
It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
|
||||
|
||||
## Financial contributions
|
||||
|
||||
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/docsify).
|
||||
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
|
||||
|
||||
## Questions
|
||||
|
||||
If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
|
||||
You can also reach us at hello@docsify.opencollective.com.
|
||||
|
||||
## Credits
|
||||
|
||||
### Contributors
|
||||
|
||||
Thank you to all the people who have already contributed to docsify!
|
||||
<a href="graphs/contributors"><img src="https://opencollective.com/docsify/contributors.svg?width=890" /></a>
|
||||
|
||||
|
||||
### Backers
|
||||
|
||||
Thank you to all our backers! [[Become a backer](https://opencollective.com/docsify#backer)]
|
||||
|
||||
<a href="https://opencollective.com/docsify#backers" target="_blank"><img src="https://opencollective.com/docsify/backers.svg?width=890"></a>
|
||||
|
||||
|
||||
### Sponsors
|
||||
|
||||
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/docsify#sponsor))
|
||||
|
||||
<a href="https://opencollective.com/docsify/sponsor/0/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/1/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/2/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/3/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/4/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/5/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/6/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/7/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/8/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/sponsor/9/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/9/avatar.svg"></a>
|
||||
|
||||
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->
|
||||
1010
HISTORY.md
1010
HISTORY.md
File diff suppressed because it is too large
Load diff
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016 - 2017 cinwell.li
|
||||
Copyright (c) 2016 - present cinwell.li
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
106
README.md
106
README.md
|
|
@ -1,6 +1,6 @@
|
|||
<p align="center">
|
||||
<a href="https://docsify.js.org">
|
||||
<img alt="docsify" src="./media/docsify.png">
|
||||
<img alt="docsify" src="./docs/_media/icon.svg">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
|
|
@ -9,59 +9,60 @@
|
|||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/QingWei-Li/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/rust-lang/rust/master.svg?style=flat-square"></a>
|
||||
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/docsify/backers/badge.svg?style=flat-square"></a>
|
||||
<a href="#sponsors"><img alt="Sponsors on Open Collective" src="https://opencollective.com/docsify/sponsors/badge.svg?style=flat-square"></a>
|
||||
<a href="https://travis-ci.org/docsifyjs/docsify"><img alt="Travis Status" src="https://img.shields.io/travis/docsifyjs/docsify/master.svg?style=flat-square"></a>
|
||||
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
|
||||
<a href="https://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
|
||||
<a href="https://gitter.im/docsifyjs/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link"><img alt="gitter" src="https://img.shields.io/gitter/room/docsifyjs/docsify.svg?style=flat-square"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">Gold Sponsor via <a href="https://opencollective.com/docsify">Open Collective</a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://opencollective.com/docsify/order/3254">
|
||||
<img src="https://opencollective.com/docsify/tiers/gold-sponsor.svg?avatarHeight=36">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Links
|
||||
|
||||
- [`develop` branch preview](https://docsifyjs.netlify.com/)
|
||||
- [Documentation](https://docsify.js.org)
|
||||
- [CLI](https://github.com/QingWei-Li/docsify-cli)
|
||||
- [CLI](https://github.com/docsifyjs/docsify-cli)
|
||||
- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify)
|
||||
- [Awesome docsify](https://github.com/docsifyjs/awesome-docsify)
|
||||
- [Community chat](https://gitter.im/docsifyjs/Lobby)
|
||||
|
||||
## Features
|
||||
- Not build static html files
|
||||
- Simple and lightweight (~14kB gzipped)
|
||||
|
||||
- No statically built html files
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
- Compatible with IE10+
|
||||
- Compatible with IE11
|
||||
- Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo))
|
||||
- Support embedded files
|
||||
|
||||
## Quick start
|
||||
Create a `index.html`.
|
||||
|
||||
index.html
|
||||
Look at [this tutorial](https://docsify.js.org/#/quickstart)
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
</html>
|
||||
```
|
||||
|
||||
## Browser Support
|
||||
|
||||
Modern browsers and Internet Explorer 9+.
|
||||
[](https://codesandbox.io/s/307qqv236)
|
||||
|
||||
## Showcase
|
||||
These open-source projects are using docsify to generate their sites. Pull requests welcome : )
|
||||
|
||||
- [Snipaste](https://docs.snipaste.com/) - Snip & Paste
|
||||
- [puck](https://puck.zz173.com/) - A small & magical php framework.
|
||||
- [Samaritan](http://samaritan.stockdb.org) - An Algorithmic Trading Framework for Digital Currency.
|
||||
- [Vudash](http://vudash.github.io/vudash/) - Powerful, Flexible, Open Source dashboards for anything
|
||||
- [Trilogy](http://trilogy.js.org) - No-hassle SQLite with a Promise-based, document store style API.
|
||||
- [Mybatis-Plus](http://mp.baomidou.com/) - An enhanced toolkit of Mybatis to simplify development
|
||||
These projects are using docsify to generate their sites. Pull requests welcome :blush:
|
||||
|
||||
Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
|
||||
|
||||
## Similar projects
|
||||
- [docute](https://github.com/egoist/docute) - 📜 Effortlessly documentation done right
|
||||
- [docpress](https://github.com/docpress/docpress) - Documentation website generator
|
||||
|
||||
| Project | Description |
|
||||
| ------------------------------------------------ | ---------------------------------------- |
|
||||
| [docute](https://github.com/egoist/docute) | 📜 Effortlessly documentation done right |
|
||||
| [docpress](https://github.com/docpress/docpress) | Documentation website generator |
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
@ -69,15 +70,42 @@ These open-source projects are using docsify to generate their sites. Pull reque
|
|||
- Create your feature branch: `git checkout -b my-new-feature`
|
||||
- Commit your changes: `git commit -am 'Add some feature'`
|
||||
- Push to the branch: `git push origin my-new-feature`
|
||||
- Submit a pull request :D
|
||||
|
||||
- Submit a pull request
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
npm i && npm run dev
|
||||
open http://localhost:3000
|
||||
npm run bootstrap && npm run dev
|
||||
```
|
||||
|
||||
## Backers
|
||||
|
||||
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/docsify#backers)]
|
||||
|
||||
<a href="https://opencollective.com/docsify#backers" target="_blank"><img src="https://opencollective.com/docsify/backers.svg?width=890"></a>
|
||||
|
||||
## Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/docsify#silver-sponsors)]
|
||||
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/0/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/1/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/2/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/3/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/4/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/5/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/6/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/7/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/8/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/docsify/silver-sponsors/9/website" target="_blank"><img src="https://opencollective.com/docsify/silver-sponsors/9/avatar.svg"></a>
|
||||
|
||||
## Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
|
||||
<a href="https://github.com/docsifyjs/docsify/graphs/contributors"><img src="https://opencollective.com/docsify/contributors.svg?width=890" /></a>
|
||||
|
||||
## License
|
||||
MIT
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fdocsifyjs%2Fdocsify?ref=badge_large)
|
||||
|
|
|
|||
12
app.js
12
app.js
|
|
@ -1,12 +0,0 @@
|
|||
var serveStatic = require('serve-static')
|
||||
var http = require('http')
|
||||
var fs = require('fs')
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
serveStatic('.')(req, res, function () {
|
||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
||||
res.end(fs.readFileSync('dev.html'))
|
||||
})
|
||||
}).listen(3000, '0.0.0.0')
|
||||
|
||||
console.log(`\nListening at http://0.0.0.0:3000\n`)
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
var fs = require('fs')
|
||||
var cssnano = require('cssnano').process
|
||||
var resolve = require('path').resolve
|
||||
var postcss = require('postcss')
|
||||
var isProd = process.argv[process.argv.length - 1] !== '--dev'
|
||||
|
||||
var processor = postcss([require('postcss-salad')({
|
||||
features: {
|
||||
precss: {
|
||||
properties: {
|
||||
preserve: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})])
|
||||
|
||||
var saveMin = function (file, content) {
|
||||
fs.writeFileSync(resolve(__dirname, '../lib/themes/', file), content)
|
||||
}
|
||||
var save = function (file, content) {
|
||||
fs.writeFileSync(resolve(__dirname, '../themes/', file), content)
|
||||
}
|
||||
var load = function (file) {
|
||||
return fs.readFileSync(resolve(__dirname, '../src/themes/', file)).toString()
|
||||
}
|
||||
var loadLib = function (file) {
|
||||
return fs.readFileSync(resolve(__dirname, '../themes/', file)).toString()
|
||||
}
|
||||
|
||||
var list = fs.readdirSync(resolve(__dirname, '../src/themes'))
|
||||
|
||||
list.forEach(function (file) {
|
||||
if (!/\.css$/.test(file)) return
|
||||
processor.process(load(file), { from: resolve(__dirname, '../src/themes/', file) })
|
||||
.then(function (result) {
|
||||
save(file, result.css)
|
||||
console.log('salad - ' + file)
|
||||
isProd && cssnano(loadLib(file))
|
||||
.then(function (result) {
|
||||
saveMin(file, result.css)
|
||||
console.log('cssnao - ' + file)
|
||||
})
|
||||
}).catch(function (err) {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
|
||||
137
build/build.js
137
build/build.js
|
|
@ -1,62 +1,119 @@
|
|||
var rollup = require('rollup')
|
||||
var buble = require('rollup-plugin-buble')
|
||||
var commonjs = require('rollup-plugin-commonjs')
|
||||
var nodeResolve = require('rollup-plugin-node-resolve')
|
||||
var uglify = require('rollup-plugin-uglify')
|
||||
var isProd = process.argv[process.argv.length - 1] !== '--dev'
|
||||
const rollup = require('rollup')
|
||||
const buble = require('rollup-plugin-buble')
|
||||
const commonjs = require('rollup-plugin-commonjs')
|
||||
const nodeResolve = require('rollup-plugin-node-resolve')
|
||||
const uglify = require('rollup-plugin-uglify')
|
||||
const replace = require('rollup-plugin-replace')
|
||||
const isProd = process.env.NODE_ENV === 'production'
|
||||
const version = process.env.VERSION || require('../package.json').version
|
||||
const chokidar = require('chokidar')
|
||||
const path = require('path')
|
||||
|
||||
var build = function (opts) {
|
||||
const build = function (opts) {
|
||||
rollup
|
||||
.rollup({
|
||||
entry: 'src/' + opts.entry,
|
||||
plugins: [buble(), commonjs(), nodeResolve()].concat(opts.plugins || [])
|
||||
input: opts.input,
|
||||
plugins: (opts.plugins || []).concat([
|
||||
buble(),
|
||||
commonjs(),
|
||||
nodeResolve(),
|
||||
replace({
|
||||
__VERSION__: version,
|
||||
'process.env.SSR': false
|
||||
})
|
||||
])
|
||||
})
|
||||
.then(function (bundle) {
|
||||
var dest = 'lib/' + (opts.output || opts.entry)
|
||||
var dest = 'lib/' + (opts.output || opts.input)
|
||||
|
||||
console.log(dest)
|
||||
bundle.write({
|
||||
format: 'iife',
|
||||
moduleName: opts.moduleName || 'D',
|
||||
dest: dest
|
||||
file: dest,
|
||||
strict: false
|
||||
})
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
|
||||
build({
|
||||
entry: 'core/index.js',
|
||||
output: 'docsify.js'
|
||||
})
|
||||
|
||||
var plugins = [
|
||||
{ name: 'search', entry: 'search/index.js', moduleName: 'Search' },
|
||||
{ name: 'ga', entry: 'ga.js', moduleName: 'GA' }
|
||||
// { name: 'front-matter', entry: 'front-matter/index.js', moduleName: 'FrontMatter' }
|
||||
]
|
||||
|
||||
plugins.forEach(item => {
|
||||
const buildCore = function () {
|
||||
build({
|
||||
entry: 'plugins/' + item.entry,
|
||||
output: 'plugins/' + item.name + '.js',
|
||||
moduleName: 'D.' + item.moduleName
|
||||
input: 'src/core/index.js',
|
||||
output: 'docsify.js'
|
||||
})
|
||||
})
|
||||
|
||||
if (isProd) {
|
||||
build({
|
||||
entry: 'core/index.js',
|
||||
output: 'docsify.min.js',
|
||||
plugins: [uglify()]
|
||||
})
|
||||
plugins.forEach(item => {
|
||||
if (isProd) {
|
||||
build({
|
||||
entry: 'plugins/' + item.entry,
|
||||
output: 'plugins/' + item.name + '.min.js',
|
||||
moduleName: 'D.' + item.moduleName,
|
||||
input: 'src/core/index.js',
|
||||
output: 'docsify.min.js',
|
||||
plugins: [uglify()]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
const buildAllPlugin = function () {
|
||||
var plugins = [
|
||||
{name: 'search', input: 'search/index.js'},
|
||||
{name: 'ga', input: 'ga.js'},
|
||||
{name: 'matomo', input: 'matomo.js'},
|
||||
{name: 'emoji', input: 'emoji.js'},
|
||||
{name: 'external-script', input: 'external-script.js'},
|
||||
{name: 'front-matter', input: 'front-matter/index.js'},
|
||||
{name: 'zoom-image', input: 'zoom-image.js'},
|
||||
{name: 'disqus', input: 'disqus.js'},
|
||||
{name: 'gitalk', input: 'gitalk.js'}
|
||||
]
|
||||
|
||||
plugins.forEach(item => {
|
||||
build({
|
||||
input: 'src/plugins/' + item.input,
|
||||
output: 'plugins/' + item.name + '.js'
|
||||
})
|
||||
})
|
||||
|
||||
if (isProd) {
|
||||
plugins.forEach(item => {
|
||||
build({
|
||||
input: 'src/plugins/' + item.input,
|
||||
output: 'plugins/' + item.name + '.min.js',
|
||||
plugins: [uglify()]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (!isProd) {
|
||||
chokidar
|
||||
.watch(['src/core', 'src/plugins'], {
|
||||
atomic: true,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 1000,
|
||||
pollInterval: 100
|
||||
}
|
||||
})
|
||||
.on('change', p => {
|
||||
console.log('[watch] ', p)
|
||||
const dirs = p.split(path.sep)
|
||||
if (dirs[1] === 'core') {
|
||||
buildCore()
|
||||
} else if (dirs[2]) {
|
||||
const name = path.basename(dirs[2], '.js')
|
||||
const input = `src/plugins/${name}${
|
||||
/\.js/.test(dirs[2]) ? '' : '/index'
|
||||
}.js`
|
||||
|
||||
build({
|
||||
input,
|
||||
output: 'plugins/' + name + '.js'
|
||||
})
|
||||
}
|
||||
})
|
||||
.on('ready', () => {
|
||||
console.log('[start]')
|
||||
buildCore()
|
||||
buildAllPlugin()
|
||||
})
|
||||
} else {
|
||||
buildCore()
|
||||
buildAllPlugin()
|
||||
}
|
||||
|
|
|
|||
14
build/cover.js
Normal file
14
build/cover.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
var fs = require('fs')
|
||||
var read = fs.readFileSync
|
||||
var write = fs.writeFileSync
|
||||
var version = process.env.VERSION || require('../package.json').version
|
||||
|
||||
var file = __dirname + '/../docs/_coverpage.md'
|
||||
var cover = read(file, 'utf8').toString()
|
||||
|
||||
console.log('Replace version number in cover page...')
|
||||
cover = cover.replace(
|
||||
/<small>(\S+)?<\/small>/g,
|
||||
'<small>' + version + '</small>'
|
||||
)
|
||||
write(file, cover)
|
||||
12
build/mincss.js
Normal file
12
build/mincss.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
const cssnano = require('cssnano').process
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
|
||||
files = fs.readdirSync(path.resolve('lib/themes'))
|
||||
|
||||
files.forEach(file => {
|
||||
file = path.resolve('lib/themes', file)
|
||||
cssnano(fs.readFileSync(file)).then(result => {
|
||||
fs.writeFileSync(file, result.css)
|
||||
})
|
||||
})
|
||||
50
build/release.sh
Executable file
50
build/release.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
set -e
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Enter new version: "
|
||||
read VERSION
|
||||
else
|
||||
VERSION=$1
|
||||
fi
|
||||
|
||||
read -p "Releasing $VERSION $RELEASE_TAG - are you sure? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Releasing $VERSION ..."
|
||||
|
||||
npm run test
|
||||
|
||||
# build
|
||||
VERSION=$VERSION npm run build
|
||||
|
||||
# update packages
|
||||
cd packages/docsify-server-renderer
|
||||
npm version $VERSION
|
||||
if [[ -z $RELEASE_TAG ]]; then
|
||||
npm publish
|
||||
else
|
||||
npm publish --tag $RELEASE_TAG
|
||||
fi
|
||||
cd -
|
||||
|
||||
# commit
|
||||
git add -A
|
||||
git commit -m "[build] $VERSION $RELEASE_TAG"
|
||||
npm --no-git-tag-version version $VERSION --message "[release] $VERSION $RELEASE_TAG"
|
||||
|
||||
# changelog
|
||||
node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s
|
||||
|
||||
git add .
|
||||
git commit -m "chore: add changelog $VERSION"
|
||||
|
||||
# publish
|
||||
git tag v$VERSION
|
||||
git push origin refs/tags/v$VERSION
|
||||
git push
|
||||
if [[ -z $RELEASE_TAG ]]; then
|
||||
npm publish
|
||||
else
|
||||
npm publish --tag $RELEASE_TAG
|
||||
fi
|
||||
fi
|
||||
34
build/ssr.js
Normal file
34
build/ssr.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
var rollup = require('rollup')
|
||||
var buble = require('rollup-plugin-buble')
|
||||
var async = require('rollup-plugin-async')
|
||||
var replace = require('rollup-plugin-replace')
|
||||
|
||||
rollup
|
||||
.rollup({
|
||||
input: 'packages/docsify-server-renderer/index.js',
|
||||
plugins: [
|
||||
async(),
|
||||
replace({
|
||||
__VERSION__: process.env.VERSION || require('../package.json').version,
|
||||
'process.env.SSR': true
|
||||
}),
|
||||
buble({
|
||||
transforms: {
|
||||
generator: false
|
||||
}
|
||||
})
|
||||
],
|
||||
onwarn: function () {}
|
||||
})
|
||||
.then(function (bundle) {
|
||||
var dest = 'packages/docsify-server-renderer/build.js'
|
||||
|
||||
console.log(dest)
|
||||
bundle.write({
|
||||
format: 'cjs',
|
||||
file: dest
|
||||
})
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err)
|
||||
})
|
||||
34
dev.html
34
dev.html
|
|
@ -1,34 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="/themes/vue.css" title="vue">
|
||||
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
|
||||
</head>
|
||||
<body>
|
||||
<nav data-cloak>
|
||||
<a href="#/">EN</a>
|
||||
<a href="#/zh-cn/">中文</a>
|
||||
</nav>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
},
|
||||
executeScript: true
|
||||
}
|
||||
</script>
|
||||
<script
|
||||
src="/lib/docsify.js"
|
||||
data-name="docsify"
|
||||
data-base-path="/docs/"
|
||||
data-load-sidebar
|
||||
data-sub-max-level="2"
|
||||
data-auto2top></script>
|
||||
</html>
|
||||
|
|
@ -2,26 +2,31 @@
|
|||
|
||||
> A magical documentation site generator.
|
||||
|
||||
## What is it
|
||||
## What it is
|
||||
|
||||
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. It smartly loads and parses your Markdown files and displays them in website. All you need to do is create an `index.html` to start and [deploy it on GitHub Pages](/deploy).
|
||||
docsify generates your documentation website on the fly. Unlike GitBook, it does not generate static html files. Instead, it smartly loads and parses your Markdown files and displays them as a website. To start using it, all you need to do is create an `index.html` and [deploy it on GitHub Pages](deploy.md).
|
||||
|
||||
See the [Quick start](/quickstart) for more details.
|
||||
See the [Quick start](quickstart.md) guide for more details.
|
||||
|
||||
## Features
|
||||
|
||||
- Not build static html files
|
||||
- Simple and lightweight (~14kB gzipped)
|
||||
- No statically built html files
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- Smart full-text search plugin
|
||||
- Multiple themes
|
||||
- Useful plugin API
|
||||
- Compatible with IE10+
|
||||
- Emoji support
|
||||
- Compatible with IE11
|
||||
- Support server-side rendering ([example](https://github.com/docsifyjs/docsify-ssr-demo))
|
||||
|
||||
## Examples
|
||||
|
||||
Check out the [Showcase](https://github.com/QingWei-Li/docsify/#showcase) to see use the docsify generated website.
|
||||
Check out the [Showcase](https://github.com/docsifyjs/awesome-docsify#showcase) to see docsify in use.
|
||||
|
||||
## Donate
|
||||
|
||||
If you think docsify is helpful to you or that my work is valuable. I am happy if you can help me [buy a cup of coffee](https://github.com/QingWei-Li/donate). :heart:
|
||||
Please consider donating if you think docsify is helpful to you or that my work is valuable. I am happy if you can help me [buy a cup of coffee](https://github.com/QingWei-Li/donate). :heart:
|
||||
|
||||
## Community
|
||||
|
||||
Users and the development team are usually in the [Gitter chat room](https://gitter.im/docsifyjs/Lobby).
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||

|
||||
|
||||
# docsify <small>3.0</small>
|
||||
# docsify <small>4.9.4</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
- Simple and lightweight (~14kB gzipped)
|
||||
- Not build static html files
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- No statically built html files
|
||||
- Multiple themes
|
||||
|
||||
|
||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||
[Get Started](#docsify)
|
||||
[GitHub](https://github.com/docsifyjs/docsify/)
|
||||
[Getting Started](#docsify)
|
||||
|
|
|
|||
1
docs/_media/example.html
Normal file
1
docs/_media/example.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<h1>To infinity and Beyond!</h1>
|
||||
16
docs/_media/example.js
Normal file
16
docs/_media/example.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import fetch from 'fetch'
|
||||
|
||||
const URL = 'https://example.com'
|
||||
const PORT = 8080
|
||||
|
||||
/// [demo]
|
||||
const result = fetch(`${URL}:${PORT}`)
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function(myJson) {
|
||||
console.log(JSON.stringify(myJson));
|
||||
});
|
||||
/// [demo]
|
||||
|
||||
result.then(console.log).catch(console.error)
|
||||
1
docs/_media/example.md
Normal file
1
docs/_media/example.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
> This is from the `example.md`
|
||||
6
docs/_navbar.md
Normal file
6
docs/_navbar.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
- Translations
|
||||
- [:uk: English](/)
|
||||
- [:cn: 中文](/zh-cn/)
|
||||
- [:de: Deutsch](/de-de/)
|
||||
- [:es: Spanish](/es/)
|
||||
- [:ru: Russian](/ru/)
|
||||
|
|
@ -1,20 +1,28 @@
|
|||
- Getting started
|
||||
- [Quick start](/quickstart)
|
||||
- [Writing more pages](/more-pages)
|
||||
- [Custom navbar](/custom-navbar)
|
||||
- [Cover page](/cover)
|
||||
|
||||
- [Quick start](quickstart.md)
|
||||
- [Writing more pages](more-pages.md)
|
||||
- [Custom navbar](custom-navbar.md)
|
||||
- [Cover page](cover.md)
|
||||
|
||||
- Customization
|
||||
- [Configuration](/configuration)
|
||||
- [Themes](/themes)
|
||||
- [Using plugins](/plugins)
|
||||
- [Markdown configuration](/markdown)
|
||||
- [Lanuage highlight](/language-highlight)
|
||||
|
||||
- [Configuration](configuration.md)
|
||||
- [Themes](themes.md)
|
||||
- [List of Plugins](plugins.md)
|
||||
- [Write a Plugin](write-a-plugin.md)
|
||||
- [Markdown configuration](markdown.md)
|
||||
- [Language highlighting](language-highlight.md)
|
||||
|
||||
- Guide
|
||||
- [Deploy](/deploy)
|
||||
- [Doc helper](/helpers)
|
||||
- [Compatible Vue](/vue)
|
||||
- [CDN](/cdn)
|
||||
|
||||
- [Changelog](/changelog)
|
||||
- [Deploy](deploy.md)
|
||||
- [Helpers](helpers.md)
|
||||
- [Vue compatibility](vue.md)
|
||||
- [CDN](cdn.md)
|
||||
- [Offline Mode(PWA)](pwa.md)
|
||||
- [Server-Side Rendering(SSR)](ssr.md)
|
||||
- [Embed Files](embed-files.md)
|
||||
|
||||
- [Awesome docsify](awesome.md)
|
||||
- [Changelog](changelog.md)
|
||||
|
|
|
|||
18
docs/cdn.md
18
docs/cdn.md
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [unpkg.com/docsify/](//unpkg.com/docsify/).
|
||||
|
||||
|
||||
## Latest version
|
||||
|
||||
|
||||
```html
|
||||
<!-- load css -->
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
|
|
@ -14,8 +12,9 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
|
|||
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
|
||||
```
|
||||
|
||||
## Specific version
|
||||
Alternatively, use [compressed files](#compressed-file).
|
||||
|
||||
## Specific version
|
||||
|
||||
```html
|
||||
<!-- load css -->
|
||||
|
|
@ -27,7 +26,6 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
|
|||
|
||||
## Compressed file
|
||||
|
||||
|
||||
```html
|
||||
<!-- load css -->
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
|
||||
|
|
@ -36,7 +34,17 @@ Recommended: [unpkg](//unpkg.com), which will reflect the latest version as soon
|
|||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
```html
|
||||
<!-- load css -->
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/lib/themes/vue.css">
|
||||
|
||||
<!-- load script -->
|
||||
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
## Other CDN
|
||||
|
||||
[jsDelivr](http://www.jsdelivr.com/projects/docsify) is available.
|
||||
- http://www.bootcdn.cn/docsify
|
||||
- https://cdn.jsdelivr.net/npm/docsify/
|
||||
- https://cdnjs.com/libraries/docsify
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,17 @@
|
|||
# Configuration
|
||||
|
||||
docsify supports two ways to configure. You can configure the `window.$docsify` or write configuration on the script tag via `data-*` attributes.
|
||||
You can configure the `window.$docsify`.
|
||||
|
||||
```html
|
||||
<!-- by $docsify -->
|
||||
<script>
|
||||
window.$docsify = {
|
||||
repo: 'QingWei-Li/docsify',
|
||||
repo: 'docsifyjs/docsify',
|
||||
maxLevel: 3,
|
||||
coverpage: true
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- or data-* -->
|
||||
<script
|
||||
src="//unpkg.com/docsify"
|
||||
data-repo="QingWei-Li/docsify"
|
||||
data-max-level="3"
|
||||
data-coverpage>
|
||||
</script>
|
||||
```
|
||||
|
||||
Both ways are compatible. However, the first way is recommended. It is clear and can be configured in a separate file.
|
||||
|
||||
!> In `window.$docsfiy`, the options should be written by camelCase.
|
||||
|
||||
## el
|
||||
|
||||
- Type: `String`
|
||||
|
|
@ -35,7 +22,7 @@ The DOM element to be mounted on initialization. It can be a CSS selector string
|
|||
```js
|
||||
window.$docsify = {
|
||||
el: '#app'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## repo
|
||||
|
|
@ -47,14 +34,13 @@ Configure the repository url or a string of `username/repo` can add the [GitHub
|
|||
|
||||
```js
|
||||
window.$docsify = {
|
||||
repo: 'QingWei-Li/docsify',
|
||||
repo: 'docsifyjs/docsify',
|
||||
// or
|
||||
repo: 'https://github.com/QingWei-Li/docsify/'
|
||||
}
|
||||
repo: 'https://github.com/docsifyjs/docsify/'
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## max-level
|
||||
## maxLevel
|
||||
|
||||
- Type: `Number`
|
||||
- Default: `6`
|
||||
|
|
@ -64,15 +50,15 @@ Maximum Table of content level.
|
|||
```js
|
||||
window.$docsify = {
|
||||
maxLevel: 4
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## load-navbar
|
||||
## loadNavbar
|
||||
|
||||
- Type: `Boolean|String`
|
||||
- Default: `false`
|
||||
|
||||
Load navbar from Markdown file. If **true** it will be loaded from `_navbar.md`.
|
||||
Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
|
|
@ -81,16 +67,15 @@ window.$docsify = {
|
|||
|
||||
// load from nav.md
|
||||
loadNavbar: 'nav.md'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## load-sidebar
|
||||
## loadSidebar
|
||||
|
||||
- Type: `Boolean|String`
|
||||
- Default: `false`
|
||||
|
||||
|
||||
Load sidebar from Markdown file. If **true** it will be loaded from `_sidebar.md`.
|
||||
Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
|
|
@ -99,44 +84,40 @@ window.$docsify = {
|
|||
|
||||
// load from summary.md
|
||||
loadSidebar: 'summary.md'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## sub-max-level
|
||||
## subMaxLevel
|
||||
|
||||
- Type: `Number`
|
||||
- Default: `0`
|
||||
|
||||
Add TOC in custom sidebar.
|
||||
Add table of contents (TOC) in custom sidebar.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
subMaxLevel: 2
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## auto2top
|
||||
|
||||
- Type: `Boolean`
|
||||
- Default: `false`
|
||||
|
||||
|
||||
Scrolls to the top of the screen when the route is changed.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
auto2top: true
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## homepage
|
||||
|
||||
- Type: `String`
|
||||
- Default: `README.md`
|
||||
|
||||
|
||||
`README.md` in your docs folder will be treated as homepage for your website, but sometimes you may need to serve another file as your homepage.
|
||||
|
||||
```js
|
||||
|
|
@ -145,11 +126,12 @@ window.$docsify = {
|
|||
homepage: 'home.md',
|
||||
|
||||
// Or use the readme in your repo
|
||||
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
|
||||
}
|
||||
homepage:
|
||||
'https://raw.githubusercontent.com/docsifyjs/docsify/master/README.md'
|
||||
};
|
||||
```
|
||||
|
||||
## base-path
|
||||
## basePath
|
||||
|
||||
- Type: `String`
|
||||
|
||||
|
|
@ -163,41 +145,101 @@ window.$docsify = {
|
|||
basePath: 'https://docsify.js.org/',
|
||||
|
||||
// Even can load files from other repo
|
||||
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
|
||||
}
|
||||
basePath:
|
||||
'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
|
||||
};
|
||||
```
|
||||
|
||||
## relativePath
|
||||
|
||||
- Type: `Boolean`
|
||||
- Default: `false`
|
||||
|
||||
If **true** links are relative to the current context.
|
||||
|
||||
For example, the directory structure is as follows:
|
||||
|
||||
```text
|
||||
.
|
||||
└── docs
|
||||
├── README.md
|
||||
├── guide.md
|
||||
└── zh-cn
|
||||
├── README.md
|
||||
├── guide.md
|
||||
└── config
|
||||
└── example.md
|
||||
```
|
||||
|
||||
With relative path **enabled** and current URL `http://domain.com/zh-cn/README`, given links will resolve to:
|
||||
|
||||
```text
|
||||
guide.md => http://domain.com/zh-cn/guide
|
||||
config/example.md => http://domain.com/zh-cn/config/example
|
||||
../README.md => http://domain.com/README
|
||||
/README.md => http://domain.com/README
|
||||
```
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
// Relative path enabled
|
||||
relativePath: true,
|
||||
|
||||
// Relative path disabled (default value)
|
||||
relativePath: false
|
||||
};
|
||||
```
|
||||
|
||||
## coverpage
|
||||
|
||||
- Type: `Boolean|String`
|
||||
- Type: `Boolean|String|String[]|Object`
|
||||
- Default: `false`
|
||||
|
||||
Activate the [cover feature](/cover). If ture, it will load from `_coverpage.md`.
|
||||
Activate the [cover feature](cover.md). If true, it will load from `_coverpage.md`.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
coverpage: true,
|
||||
|
||||
// Custom file name
|
||||
coverpage: 'cover.md'
|
||||
}
|
||||
coverpage: 'cover.md',
|
||||
|
||||
// mutiple covers
|
||||
coverpage: ['/', '/zh-cn/'],
|
||||
|
||||
// mutiple covers and custom file name
|
||||
coverpage: {
|
||||
'/': 'cover.md',
|
||||
'/zh-cn/': 'cover.md'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## logo
|
||||
|
||||
- Type: `String`
|
||||
|
||||
Website logo as it appears in the sidebar, you can resize by CSS.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
logo: '/_media/icon.svg'
|
||||
};
|
||||
```
|
||||
|
||||
## name
|
||||
|
||||
- Type: `String`
|
||||
|
||||
|
||||
Website name appears in the sidebar.
|
||||
Website name as it appears in the sidebar.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
name: 'docsify'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## name-link
|
||||
## nameLink
|
||||
|
||||
- Type: `String`
|
||||
- Default: `window.location.pathname`
|
||||
|
|
@ -206,16 +248,21 @@ The name of the link.
|
|||
|
||||
```js
|
||||
window.$docsify = {
|
||||
nameLink: '/'
|
||||
}
|
||||
nameLink: '/',
|
||||
|
||||
// For each route
|
||||
nameLink: {
|
||||
'/zh-cn/': '/zh-cn/',
|
||||
'/': '/'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## markdown
|
||||
|
||||
- Type: `Function`
|
||||
|
||||
See [Markdown configuration](/markdown).
|
||||
|
||||
See [Markdown configuration](markdown.md).
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
|
|
@ -230,65 +277,66 @@ window.$docsify = {
|
|||
},
|
||||
|
||||
// function
|
||||
markdown: function (marked, renderer) {
|
||||
markdown: function(marked, renderer) {
|
||||
// ...
|
||||
return marked
|
||||
return marked;
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## theme-color
|
||||
## themeColor
|
||||
|
||||
- Type: `String`
|
||||
|
||||
Customize the theme color.
|
||||
Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
|
||||
Customize the theme color. Use [CSS3 variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) feature and polyfill in old browser.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
themeColor: '#3F51B5'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## alias
|
||||
|
||||
- Type: `Object`
|
||||
|
||||
|
||||
Set the route alias. You can freely manage routing rules.
|
||||
Set the route alias. You can freely manage routing rules. Supports RegExp.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'/foo/(+*)': '/bar/$1', // supports regexp
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
'/changelog':
|
||||
'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG',
|
||||
'/.*/_sidebar.md': '/_sidebar.md' // See #301
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## auto-header
|
||||
## autoHeader
|
||||
|
||||
- type: `Boolean`
|
||||
|
||||
If `loadSidebar` and `autoHeader` are both enabled, for each link in _sidebar.md, prepend a header to the page before converting it to html. [#78](https://github.com/QingWei-Li/docsify/issues/78)
|
||||
If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to html. Compare [#78](https://github.com/docsifyjs/docsify/issues/78).
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
loadSidebar: true,
|
||||
autoHeader: true
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## execute-script
|
||||
## executeScript
|
||||
|
||||
- type: `Boolean`
|
||||
|
||||
Execute the script on the page. Only parse the first script tag([demo](themes)). If Vue is present, it is turned on by default.
|
||||
Execute the script on the page. Only parse the first script tag([demo](themes)). If Vue is present, it is turned on by default.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
executeScript: true
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
```markdown
|
||||
|
|
@ -297,6 +345,174 @@ window.$docsify = {
|
|||
<script>
|
||||
console.log(2333)
|
||||
</script>
|
||||
|
||||
```
|
||||
|
||||
Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins.md?id=external-script) plugin.
|
||||
|
||||
## noEmoji
|
||||
|
||||
- type: `Boolean`
|
||||
|
||||
Disabled emoji parse.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
noEmoji: true
|
||||
};
|
||||
```
|
||||
|
||||
## mergeNavbar
|
||||
|
||||
- type: `Boolean`
|
||||
|
||||
Navbar will be merged with the sidebar on smaller screens.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
mergeNavbar: true
|
||||
};
|
||||
```
|
||||
|
||||
## formatUpdated
|
||||
|
||||
- type: `String|Function`
|
||||
|
||||
We can display the file update date through **{docsify-updated<span>}</span>** variable. And format it by `formatUpdated`.
|
||||
See https://github.com/lukeed/tinydate#patterns
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
formatUpdated: '{MM}/{DD} {HH}:{mm}',
|
||||
|
||||
formatUpdated: function(time) {
|
||||
// ...
|
||||
|
||||
return time;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## externalLinkTarget
|
||||
|
||||
- type: `String`
|
||||
- default: `_blank`
|
||||
|
||||
Target to open external links. Default `'_blank'` (new window/tab)
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
externalLinkTarget: '_self' // default: '_blank'
|
||||
};
|
||||
```
|
||||
|
||||
## routerMode
|
||||
|
||||
- type: `String`
|
||||
- default: `hash`
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
routerMode: 'history' // default: 'hash'
|
||||
};
|
||||
```
|
||||
|
||||
## noCompileLinks
|
||||
|
||||
- type: `Array`
|
||||
|
||||
Sometimes we do not want docsify to handle our links. See [#203](https://github.com/docsifyjs/docsify/issues/203)
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
noCompileLinks: ['/foo', '/bar/.*']
|
||||
};
|
||||
```
|
||||
|
||||
## onlyCover
|
||||
|
||||
- type: `Boolean`
|
||||
|
||||
Only coverpage is loaded when visiting the home page.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
onlyCover: false
|
||||
};
|
||||
```
|
||||
|
||||
## requestHeaders
|
||||
|
||||
- type: `Object`
|
||||
|
||||
Set the request resource headers.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
requestHeaders: {
|
||||
'x-token': 'xxx'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## ext
|
||||
|
||||
- type: `String`
|
||||
|
||||
Request file extension.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
ext: '.md'
|
||||
};
|
||||
```
|
||||
|
||||
## fallbackLanguages
|
||||
|
||||
- type: `Array<string>`
|
||||
|
||||
List of languages that will fallback to the default language when a page is request and didn't exists for the given local.
|
||||
|
||||
Example:
|
||||
|
||||
- try to fetch the page of `/de/overview`. If this page exists, it'll be displayed
|
||||
- then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed
|
||||
- then display 404 page.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
fallbackLanguages: ['fr', 'de']
|
||||
};
|
||||
```
|
||||
|
||||
## notFoundPage
|
||||
|
||||
- type: `Boolean` | `String` | `Object`
|
||||
|
||||
Load the `_404.md` file:
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
notFoundPage: true
|
||||
};
|
||||
```
|
||||
|
||||
Load the customised path of the 404 page:
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
notFoundPage: 'my404.md'
|
||||
};
|
||||
```
|
||||
|
||||
Load the right 404 page according to the localisation:
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
notFoundPage: {
|
||||
'/': '_404.md',
|
||||
'/de': 'de/_404.md'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options.
|
||||
|
|
|
|||
|
|
@ -1,57 +1,99 @@
|
|||
# Cover
|
||||
|
||||
Activate the cover feature by setting `coverpage`. The detail in [Configuration#coverpage](configuration#coverpage).
|
||||
Activate the cover feature by setting `coverpage` to **true**, compare [coverpage configuration](configuration.md#coverpage).
|
||||
|
||||
## Basic usage
|
||||
|
||||
Set `coverpage` to **true**, and create a `_coverpage.md`. You can see the effect in current website.
|
||||
|
||||
|
||||
*index.html*
|
||||
Set `coverpage` to **true**, and create a `_coverpage.md`:
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<script>
|
||||
window.$docsify = {
|
||||
coverpage: true
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
*_coverpage.md*
|
||||
|
||||
```markdown
|
||||
<!-- _coverpage.md -->
|
||||
|
||||

|
||||
|
||||
# docsify
|
||||
# docsify <small>3.5</small>
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
- Simple and lightweight (~12kb gzipped)
|
||||
- Simple and lightweight (~21kB gzipped)
|
||||
- No statically built html files
|
||||
- Multiple themes
|
||||
- Not build static html files
|
||||
|
||||
|
||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||
[Get Started](#quick-start)
|
||||
[GitHub](https://github.com/docsifyjs/docsify/)
|
||||
[Get Started](#docsify)
|
||||
```
|
||||
|
||||
!> A document site can have only one cover page.
|
||||
!> A document site can have only one coverpage!
|
||||
|
||||
## Custom background
|
||||
|
||||
The background color is generated randomly by default. You can customize the background color or image.
|
||||
|
||||
*_coverpage.md*
|
||||
The background color is generated randomly by default. You can customize the background color or a background image:
|
||||
|
||||
```markdown
|
||||
# docsify
|
||||
<!-- _coverpage.md -->
|
||||
|
||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||
# docsify <small>3.5</small>
|
||||
|
||||
[GitHub](https://github.com/docsifyjs/docsify/)
|
||||
[Get Started](#quick-start)
|
||||
|
||||
<!-- background image -->
|
||||
|
||||

|
||||
|
||||
<!-- background color -->
|
||||
|
||||

|
||||
```
|
||||
|
||||
## Coverpage as homepage
|
||||
|
||||
Normally, the coverpage and the homepage appear at the same time. Of course, you can also separate the coverpage by [onlyCover option](configuration.md#onlycover).
|
||||
|
||||
## Multiple covers
|
||||
|
||||
If your docs site is in more than one language, it may be useful to set multiple covers.
|
||||
|
||||
For example, your docs structure is like this
|
||||
|
||||
```text
|
||||
.
|
||||
└── docs
|
||||
├── README.md
|
||||
├── guide.md
|
||||
├── _coverpage.md
|
||||
└── zh-cn
|
||||
├── README.md
|
||||
└── guide.md
|
||||
└── _coverpage.md
|
||||
```
|
||||
|
||||
Now, you can set
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
coverpage: ['/', '/zh-cn/']
|
||||
};
|
||||
```
|
||||
|
||||
Or a special file name
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
coverpage: {
|
||||
'/': 'cover.md',
|
||||
'/zh-cn/': 'cover.md'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
# Custom navbar
|
||||
|
||||
You can create navbar in HTML file. But note that the link begins with `#/`.
|
||||
## HTML
|
||||
|
||||
*index.html*
|
||||
If you need custom navigation, you can create a HTML-based navigation bar.
|
||||
|
||||
!> Note that documentation links begin with `#/`.
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<body>
|
||||
<nav>
|
||||
<a href="#/">EN</a>
|
||||
|
|
@ -14,53 +18,79 @@ You can create navbar in HTML file. But note that the link begins with `#/`.
|
|||
</body>
|
||||
```
|
||||
|
||||
## Writing by Markdown
|
||||
|
||||
You can custom navbar by Markdown file. Set the `loadNavbar` to **true** and create a `_navbar.md`. The detail in [Configuration#load-navbar](configuration#load-navbar).
|
||||
|
||||
*index.html*
|
||||
## Markdown
|
||||
|
||||
Alternatively, you can create a custom markdown-based navigation file by setting `loadNavbar` to **true** and creating `_navbar.md`, compare [loadNavbar configuration](configuration.md#loadnavbar).
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadNavbar: true
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
*_navbar.md*
|
||||
|
||||
|
||||
```markdown
|
||||
- [En](/)
|
||||
- [chinese](/zh-cn/)
|
||||
<!-- _navbar.md -->
|
||||
|
||||
* [En](/)
|
||||
* [chinese](/zh-cn/)
|
||||
```
|
||||
|
||||
`_navbar.md` is loaded from each level directory. If this directory doesn't have `_navbar.md`, it will fallback to parent directory. For example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
|
||||
!> You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
|
||||
|
||||
`_navbar.md` is loaded from each level directory. If the current directory doesn't have `_navbar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_navbar.md` will be loaded from `/guide/_navbar.md`.
|
||||
|
||||
## Nesting
|
||||
|
||||
You can create sub-lists by indenting items that are under a certain parent.
|
||||
|
||||
```markdown
|
||||
- Getting started
|
||||
- [Quick start](/quickstart)
|
||||
- [Writing more pages](/more-pages)
|
||||
- [Custom navbar](/custom-navbar)
|
||||
- [Cover page](/cover)
|
||||
<!-- _navbar.md -->
|
||||
|
||||
- Configuration
|
||||
- [Configuration](/configuration)
|
||||
- [Themes](/themes)
|
||||
- [Using plugins](/plugins)
|
||||
- [Markdown configuration](/markdown)
|
||||
- [Lanuage highlight](/language-highlight)
|
||||
* Getting started
|
||||
|
||||
* [Quick start](quickstart.md)
|
||||
* [Writing more pages](more-pages.md)
|
||||
* [Custom navbar](custom-navbar.md)
|
||||
* [Cover page](cover.md)
|
||||
|
||||
* Configuration
|
||||
* [Configuration](configuration.md)
|
||||
* [Themes](themes.md)
|
||||
* [Using plugins](plugins.md)
|
||||
* [Markdown configuration](markdown.md)
|
||||
* [Language highlight](language-highlight.md)
|
||||
```
|
||||
|
||||
Example.
|
||||
renders as
|
||||
|
||||

|
||||

|
||||
|
||||
## Combining custom navbars with the emoji plugin
|
||||
|
||||
If you use the [emoji plugin](plugins#emoji):
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<script>
|
||||
window.$docsify = {
|
||||
// ...
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
|
||||
```
|
||||
|
||||
you could, for example, use flag emojis in your custom navbar Markdown file:
|
||||
|
||||
```markdown
|
||||
<!-- _navbar.md -->
|
||||
|
||||
* [:us:, :uk:](/)
|
||||
* [:cn:](/zh-cn/)
|
||||
```
|
||||
|
|
|
|||
106
docs/deploy.md
106
docs/deploy.md
|
|
@ -1,20 +1,62 @@
|
|||
# Deploy
|
||||
|
||||
As as GitBook, you can deploy files to GitHub Pages or VPS.
|
||||
Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pages, GitLab Pages or VPS.
|
||||
|
||||
## GitHub Pages
|
||||
|
||||
There're three places to populate your docs
|
||||
There're three places to populate your docs for your Github repository:
|
||||
|
||||
- `docs/` folder
|
||||
- master branch
|
||||
- gh-pages branch
|
||||
|
||||
You can save your files in `./docs` and setting `master branch /docs folder`.
|
||||
It is recommended that you save your files to the `./docs` subfolder of the `master` branch of your repository. Then select `master branch /docs folder` as your Github Pages source in your repositories' settings page.
|
||||
|
||||

|
||||
|
||||
!> You can also save files in the root directory and select `master branch`.
|
||||
You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch)
|
||||
|
||||
## GitLab Pages
|
||||
|
||||
If you are deploying your master branch, include `.gitlab-ci.yml` with the following script:
|
||||
|
||||
?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
|
||||
|
||||
```YAML
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
- mkdir .public
|
||||
- cp -r * .public
|
||||
- mv .public public
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
```
|
||||
|
||||
!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
|
||||
|
||||
## Firebase Hosting
|
||||
|
||||
!> You'll need to install the Firebase CLI using `npm i -g firebase-tools` after signing into the [Firebase Console](https://console.firebase.google.com) using a Google Account.
|
||||
|
||||
Using Terminal determine and navigate to the directory for your Firebase Project - this could be `~/Projects/Docs` etc. From there, run `firebase init`, choosing `Hosting` from the menu (use **space** to select, **arrow keys** to change options and **enter** to confirm). Follow the setup instructions.
|
||||
|
||||
You should have your `firebase.json` file looking similar to this (I changed the deployment directory from `public` to `site`):
|
||||
|
||||
```json
|
||||
{
|
||||
"hosting": {
|
||||
"public": "site",
|
||||
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Once finished, build the starting template by running `docsify init ./site` (replacing site with the deployment directory you determined when running `firebase init` - public by default). Add/edit the documentation, then run `firebase deploy` from the base project directory.
|
||||
|
||||
## VPS
|
||||
|
||||
|
|
@ -26,8 +68,64 @@ server {
|
|||
server_name your.domain.com;
|
||||
|
||||
location / {
|
||||
alias /path/to/dir/of/docs;
|
||||
alias /path/to/dir/of/docs/;
|
||||
index index.html;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Netlify
|
||||
|
||||
1. Login to your [Netlify](https://www.netlify.com/) account.
|
||||
2. In the [dashboard](https://app.netlify.com/) page, click **New site from Git**.
|
||||
3. Choose a repository where you store your docs, leave the **Build Command** area blank, fill in the Publish directory area with the directory of your `index.html`, for example it should be docs if you populated it at `docs/index.html`.
|
||||
|
||||
### HTML5 router
|
||||
|
||||
When using the HTML5 router, you need to set up redirect rules that redirect all requests to your `index.html`, it's pretty simple when you're using Netlify, populate a `\redirects` file in the docs directory and you're all set:
|
||||
|
||||
```sh
|
||||
/* /index.html 200
|
||||
```
|
||||
|
||||
## AWS Amplify
|
||||
|
||||
1. Set the routerMode in the Docsify project `index.html` to *history* mode.
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadSidebar: true,
|
||||
routerMode: 'history'
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
2. Login to your [AWS Console](https://aws.amazon.com).
|
||||
3. Go to the [AWS Amplify Dashboard](https://aws.amazon.com/amplify).
|
||||
4. Choose the **Deploy** route to setup your project.
|
||||
5. When prompted, keep the build settings empty if you're serving your docs within the root directory. If you're serving your docs from a different directory, customise your amplify.yml
|
||||
|
||||
```yml
|
||||
version: 0.1
|
||||
frontend:
|
||||
phases:
|
||||
build:
|
||||
commands:
|
||||
- echo "Nothing to build"
|
||||
artifacts:
|
||||
baseDirectory: /docs
|
||||
files:
|
||||
- '**/*'
|
||||
cache:
|
||||
paths: []
|
||||
|
||||
```
|
||||
|
||||
6. Add the following Redirect rules in their displayed order.
|
||||
|
||||
| Source address | Target address | Type |
|
||||
|----------------|----------------|---------------|
|
||||
| /<*>.md | /<*>.md | 200 (Rewrite) |
|
||||
| /<*> | /index.html | 200 (Rewrite) |
|
||||
|
||||
|
|
|
|||
81
docs/embed-files.md
Normal file
81
docs/embed-files.md
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# Embed files
|
||||
|
||||
With docsify 4.6 it is now possible to embed any type of file.
|
||||
You can embed these files as video, audio, iframes, or code blocks, and even Markdown files can even be embedded directly into the document.
|
||||
|
||||
For example, here embedded a Markdown file. You only need to do this:
|
||||
|
||||
```markdown
|
||||
[filename](_media/example.md ':include')
|
||||
```
|
||||
|
||||
Then the content of `example.md` will be displayed directly here
|
||||
|
||||
[filename](_media/example.md ':include')
|
||||
|
||||
You can check the original content for [example.md](_media/example.md ':ignore').
|
||||
|
||||
Normally, this will compiled into a link, but in docsify, if you add `:include` it will be embedded.
|
||||
|
||||
## Embedded file type
|
||||
|
||||
Currently, file extension are automatically recognized and embedded in different ways.
|
||||
|
||||
This is a supported embedding type:
|
||||
|
||||
* **iframe** `.html`, `.htm`
|
||||
* **markdown** `.markdown`, `.md`
|
||||
* **audio** `.mp3`
|
||||
* **video** `.mp4`, `.ogg`
|
||||
* **code** other file extension
|
||||
|
||||
Of course, you can force the specified. For example, you want to Markdown file as code block embedded.
|
||||
|
||||
```markdown
|
||||
[filename](_media/example.md ':include :type=code')
|
||||
```
|
||||
|
||||
You will get it
|
||||
|
||||
[filename](_media/example.md ':include :type=code')
|
||||
|
||||
## Embedded code fragments
|
||||
Sometimes you don't want to embed a whole file. Maybe because you need just a few lines but you want to compile and test the file in CI.
|
||||
|
||||
```markdown
|
||||
[filename](_media/example.js ':include :type=code :fragment=demo')
|
||||
```
|
||||
|
||||
In your code file you need to surround the fragment between `/// [demo]` lines (before and after the fragment).
|
||||
Alternatively you can use `### [demo]`.
|
||||
|
||||
Example:
|
||||
|
||||
[filename](_media/example.js ':include :type=code :fragment=demo')
|
||||
|
||||
|
||||
## Tag attribute
|
||||
|
||||
If you embed the file as `iframe`, `audio` and `video`, then you may need to set the attributes of these tags.
|
||||
|
||||
```markdown
|
||||
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
|
||||
```
|
||||
|
||||
[cinwell website](https://cinwell.com ':include :type=iframe width=100% height=400px')
|
||||
|
||||
Did you see it? You only need to write directly. You can check [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) for these attributes.
|
||||
|
||||
## The code block highlight
|
||||
|
||||
Embedding any type of source code file, you can specify the highlighted language or automatically identify.
|
||||
|
||||
```markdown
|
||||
[](_media/example.html ':include :type=code text')
|
||||
```
|
||||
|
||||
⬇️
|
||||
|
||||
[](_media/example.html ':include :type=code text')
|
||||
|
||||
?> How to set highlight? You can see [here](language-highlight.md).
|
||||
131
docs/helpers.md
131
docs/helpers.md
|
|
@ -4,23 +4,142 @@ docsify extends Markdown syntax to make your documents more readable.
|
|||
|
||||
## important content
|
||||
|
||||
Suitable for displaying important information.
|
||||
Important content like:
|
||||
|
||||
```markdown
|
||||
!> **Time** is money, my friend!
|
||||
```
|
||||
|
||||
!> **Time** is money, my friend!
|
||||
is rendered as:
|
||||
|
||||
!> **Time** is money, my friend!
|
||||
|
||||
## General tips
|
||||
|
||||
General tips.
|
||||
|
||||
General tips like:
|
||||
|
||||
```markdown
|
||||
?> *TODO* unit test
|
||||
?> _TODO_ unit test
|
||||
```
|
||||
|
||||
?> *TODO* unit test
|
||||
are rendered as:
|
||||
|
||||
?> _TODO_ unit test
|
||||
|
||||
## Ignore to compile link
|
||||
|
||||
Some time we will put some other relative path to the link, you have to need to tell docsify you don't need to compile this link. For example
|
||||
|
||||
```md
|
||||
[link](/demo/)
|
||||
```
|
||||
|
||||
It will be compiled to `<a href="/#/demo/">link</a>` and will be loaded `/demo/README.md`. Maybe you want to jump to `/demo/index.html`.
|
||||
|
||||
Now you can do that
|
||||
|
||||
```md
|
||||
[link](/demo/ ':ignore')
|
||||
```
|
||||
|
||||
You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set title for link.
|
||||
|
||||
```md
|
||||
[link](/demo/ ':ignore title')
|
||||
|
||||
<a href="/demo/" title="title">link</a>
|
||||
```
|
||||
|
||||
## Set target attribute for link
|
||||
|
||||
```md
|
||||
[link](/demo ':target=_blank')
|
||||
[link](/demo2 ':target=_self')
|
||||
```
|
||||
|
||||
## Disable link
|
||||
|
||||
```md
|
||||
[link](/demo ':disabled')
|
||||
```
|
||||
|
||||
## Github Task Lists
|
||||
|
||||
```md
|
||||
- [ ] foo
|
||||
- bar
|
||||
- [x] baz
|
||||
- [] bam <~ not working
|
||||
- [ ] bim
|
||||
- [ ] lim
|
||||
```
|
||||
|
||||
- [ ] foo
|
||||
- bar
|
||||
- [x] baz
|
||||
- [] bam <~ not working
|
||||
- [ ] bim
|
||||
- [ ] lim
|
||||
|
||||
## Image resizing
|
||||
|
||||
```md
|
||||

|
||||

|
||||
|
||||
<!-- Support percentage -->
|
||||
|
||||

|
||||
```
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Customise ID for headings
|
||||
|
||||
```md
|
||||
### 你好,世界! :id=hello-world
|
||||
```
|
||||
|
||||
## Markdown in html tag
|
||||
|
||||
You need to insert a space between the html and markdown content.
|
||||
This is useful for rendering markdown content in the details element.
|
||||
|
||||
```markdown
|
||||
<details>
|
||||
<summary>Self-assessment (Click to expand)</summary>
|
||||
|
||||
- Abc
|
||||
- Abc
|
||||
|
||||
</details>
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Self-assessment (Click to expand)</summary>
|
||||
|
||||
- Abc
|
||||
- Abc
|
||||
|
||||
</details>
|
||||
|
||||
Or markdown content can be wrapped in html tag.
|
||||
|
||||
```markdown
|
||||
<div style='color: red'>
|
||||
|
||||
- listitem
|
||||
- listitem
|
||||
- listitem
|
||||
|
||||
</div>
|
||||
```
|
||||
|
||||
<div style='color: red'>
|
||||
|
||||
- Abc
|
||||
- Abc
|
||||
|
||||
</div>
|
||||
|
|
|
|||
117
docs/index.html
117
docs/index.html
|
|
@ -1,41 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<link rel="icon" href="_media/favicon.ico">
|
||||
<meta name="google-site-verification" content="6t0LoIeFksrjF4c9sqUEsVXiQNxLp2hgoqo0KryT-sE" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
|
||||
<meta name="description" content="A magical documentation generator.">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css" title="vue">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css" title="buble" disabled>
|
||||
</head>
|
||||
<body>
|
||||
<nav data-cloak>
|
||||
<a href="#/">En</a>
|
||||
<a href="#/zh-cn/">中文</a>
|
||||
</nav>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
name: 'docsify',
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
auto2top: true,
|
||||
coverpage: true,
|
||||
loadSidebar: true,
|
||||
executeScript: true,
|
||||
alias: {
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css" title="pure" disabled>
|
||||
<script src="//unpkg.com/docsify-plugin-codefund/index.js"></script>
|
||||
<style>
|
||||
nav.app-nav li ul {
|
||||
min-width: 100px;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">Loading ...</div>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/awesome': 'https://raw.githubusercontent.com/docsifyjs/awesome-docsify/master/README.md',
|
||||
'.*?/changelog': 'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG.md',
|
||||
'/.*/_navbar.md': '/_navbar.md',
|
||||
'/zh-cn/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-zh/master/$1',
|
||||
'/de-de/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
|
||||
'/ru/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
|
||||
'/es/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1'
|
||||
},
|
||||
auto2top: true,
|
||||
coverpage: true,
|
||||
executeScript: true,
|
||||
loadSidebar: true,
|
||||
loadNavbar: true,
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
ga: 'UA-106147152-1',
|
||||
matomo: {
|
||||
host: '//matomo.thunderwave.de',
|
||||
id: 6
|
||||
},
|
||||
name: 'docsify',
|
||||
search: {
|
||||
noData: {
|
||||
'/de-de/': 'Keine Ergebnisse!',
|
||||
'/zh-cn/': '没有结果!',
|
||||
'/': 'No results!'
|
||||
},
|
||||
paths: 'auto',
|
||||
placeholder: {
|
||||
'/de-de/': 'Suche',
|
||||
'/zh-cn/': '搜索',
|
||||
'/': 'Search'
|
||||
}
|
||||
},
|
||||
formatUpdated: '{MM}/{DD} {HH}:{mm}',
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
if (/githubusercontent\.com/.test(vm.route.file)) {
|
||||
url = vm.route.file
|
||||
.replace('raw.githubusercontent.com', 'github.com')
|
||||
.replace(/\/master/, '/blob/master')
|
||||
} else {
|
||||
url = 'https://github.com/docsifyjs/docsify/blob/master/docs/' + vm.route.file
|
||||
}
|
||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||
|
||||
return editHtml
|
||||
+ html
|
||||
+ '\n\n----\n\n'
|
||||
+ '<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
|
||||
})
|
||||
},
|
||||
DocsifyCodefund.create('fae1f9a4-870c-4c25-b8e0-c80464f7a95c')
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/matomo.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||
|
||||
<script>
|
||||
((window.gitter = {}).chat = {}).options = {
|
||||
room: 'docsifyjs/Lobby'
|
||||
};
|
||||
</script>
|
||||
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
# language highlight
|
||||
|
||||
|
||||
The code language highlight tool is [Prism](https://github.com/PrismJS/prism). Only supports CSS, JavaScipt and HTML by default. You can load its component to highlight the language you need.
|
||||
|
||||
**docsify** uses [Prism](https://github.com/PrismJS/prism) to highlight code blocks in your pages. By default it only supports CSS, JavaScript and HTML. You can make **Prism** load additional languages:
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-php.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-php.min.js"></script>
|
||||
```
|
||||
|
||||
?> See fully supported highlight component [files list](https://github.com/PrismJS/prism/tree/gh-pages/components).
|
||||
?> Check the [component files](https://github.com/PrismJS/prism/tree/gh-pages/components) list for more options.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Markdown configuration
|
||||
|
||||
The Markdown parser is [marked](https://github.com/chjj/marked). You can customize how docsify renders your Markdown content to HTML. Support customize `renderer`.
|
||||
**docsify** uses [marked](https://github.com/markedjs/marked) as its Markdown parser. You can customize how it renders your Markdown content to HTML by customizing `renderer`:
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
|
|
@ -15,7 +15,7 @@ window.$docsify = {
|
|||
}
|
||||
```
|
||||
|
||||
?> Configuration Options Reference [marked documentation](https://github.com/chjj/marked#options-1)
|
||||
?> Configuration Options Reference [marked documentation](https://marked.js.org/#/USING_ADVANCED.md)
|
||||
|
||||
Even you can completely customize the parsing rules.
|
||||
|
||||
|
|
@ -28,3 +28,29 @@ window.$docsify = {
|
|||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Supports mermaid
|
||||
|
||||
```js
|
||||
// Import mermaid
|
||||
// <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css">
|
||||
// <script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||||
|
||||
var num = 0;
|
||||
mermaid.initialize({ startOnLoad: false });
|
||||
|
||||
window.$docsify = {
|
||||
markdown: {
|
||||
renderer: {
|
||||
code: function(code, lang) {
|
||||
if (lang === "mermaid") {
|
||||
return (
|
||||
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
|
||||
);
|
||||
}
|
||||
return this.origin.code.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,22 +1,21 @@
|
|||
# More pages
|
||||
|
||||
If you need more pages multi-level routing site. It is easy to achieve in docsify. A simple example: If you create a `guide.md`, then get the route is `/#/guide`.
|
||||
If you need more pages, you can simply create more markdown files in your docsify directory. If you create a file named `guide.md`, then it is accessible via `/#/guide`.
|
||||
|
||||
For example, the directory structure is as follows:
|
||||
|
||||
|
||||
```text
|
||||
-| docs/
|
||||
-| README.md
|
||||
-| guide.md
|
||||
-| zh-cn/
|
||||
-| README.md
|
||||
-| guide.md
|
||||
.
|
||||
└── docs
|
||||
├── README.md
|
||||
├── guide.md
|
||||
└── zh-cn
|
||||
├── README.md
|
||||
└── guide.md
|
||||
```
|
||||
|
||||
Matching routes
|
||||
|
||||
|
||||
```text
|
||||
docs/README.md => http://domain.com
|
||||
docs/guide.md => http://domain.com/guide
|
||||
|
|
@ -24,43 +23,103 @@ docs/zh-cn/README.md => http://domain.com/zh-cn/
|
|||
docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
||||
```
|
||||
|
||||
## Custom sidebar
|
||||
## Sidebar
|
||||
|
||||
By default, the TOC in sidebar is automatically generated based on Markdown file. You can create a Table of Contents page to list down pages in your site.
|
||||
In order to have sidebar, then you can create your own `_sidebar.md` (see [this documentation's sidebar](https://github.com/docsifyjs/docsify/blob/master/docs/_sidebar.md) for an example):
|
||||
|
||||
First, you need to set `loadSidebar` to **true**. The detail in [Configuration#load-sidebar](configuration#load-sidebar).
|
||||
First, you need to set `loadSidebar` to **true**. Details are available in the [configuration paragraph](configuration.md#loadsidebar).
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadSidebar: true
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
Create the `_sidebar.md`
|
||||
Create the `_sidebar.md`:
|
||||
|
||||
```markdown
|
||||
- [Home](/)
|
||||
- [Guide](/guide)
|
||||
<!-- docs/_sidebar.md -->
|
||||
|
||||
* [Home](/)
|
||||
* [Guide](guide.md)
|
||||
```
|
||||
|
||||
!> Need create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
|
||||
You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignoring files that begin with an underscore.
|
||||
|
||||
`_sidebar.md` is loaded from each level directory. If this directory doesn't have `_sidebar.md`, it will fallback to parent directory. For example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
|
||||
## Nested Sidebars
|
||||
|
||||
You may want the sidebar to update with only navigation to reflect the current directory. This can be done by adding a `_sidebar.md` file to each folder.
|
||||
|
||||
`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
|
||||
|
||||
You can specify `alias` to avoid unnecessary fallback.
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadSidebar: true,
|
||||
alias: {
|
||||
'/.*/_sidebar.md': '/_sidebar.md'
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
!> You can create a `README.md` file in a subdirectory to use it as the landing page for the route.
|
||||
|
||||
## Set Page Titles from Sidebar Selection
|
||||
|
||||
A page's `title` tag is generated from the _selected_ sidebar item name. For better SEO, you can customize the title by specifying a string after the filename.
|
||||
|
||||
```markdown
|
||||
<!-- docs/_sidebar.md -->
|
||||
* [Home](/)
|
||||
* [Guide](guide.md "The greatest guide in the world")
|
||||
```
|
||||
|
||||
## Table of Contents
|
||||
|
||||
Custom sidebar can also be automatically generate TOC by setting `subMaxLevel`. The detail in [Configuration#sub-max-level](configuration#sub-max-level).
|
||||
Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files.
|
||||
|
||||
A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [subMaxLevel configuration](configuration.md#submaxlevel).
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadSidebar: true,
|
||||
subMaxLevel: 2
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
## Ignoring Subheaders
|
||||
|
||||
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
|
||||
|
||||
```markdown
|
||||
# Getting Started
|
||||
|
||||
## Header {docsify-ignore}
|
||||
|
||||
This header won't appear in the sidebar table of contents.
|
||||
```
|
||||
|
||||
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
|
||||
|
||||
```markdown
|
||||
# Getting Started {docsify-ignore-all}
|
||||
|
||||
## Header
|
||||
|
||||
This header won't appear in the sidebar table of contents.
|
||||
```
|
||||
|
||||
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
|
||||
|
|
|
|||
197
docs/plugins.md
197
docs/plugins.md
|
|
@ -1,12 +1,9 @@
|
|||
# Using plugins
|
||||
# List of Plugins
|
||||
|
||||
## List of Plugins
|
||||
|
||||
### Full text search
|
||||
## Full text search
|
||||
|
||||
By default, the hyperlink on the current page is recognized and the content is saved in `localStorage`. You can also specify the path to the files.
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
|
|
@ -19,7 +16,7 @@ By default, the hyperlink on the current page is recognized and the content is s
|
|||
'/zh-cn/', // => /zh-cn/README.md
|
||||
],
|
||||
|
||||
// 完整配置参数
|
||||
// complete configuration parameters
|
||||
search: {
|
||||
maxAge: 86400000, // Expiration time, the default one day
|
||||
paths: [], // or 'auto'
|
||||
|
|
@ -29,16 +26,32 @@ By default, the hyperlink on the current page is recognized and the content is s
|
|||
placeholder: {
|
||||
'/zh-cn/': '搜索',
|
||||
'/': 'Type to search'
|
||||
}
|
||||
},
|
||||
|
||||
noData: 'No Results!',
|
||||
|
||||
// Localization
|
||||
noData: {
|
||||
'/zh-cn/': '找不到结果',
|
||||
'/': 'No Results'
|
||||
},
|
||||
|
||||
// Headline depth, 1 - 6
|
||||
depth: 2,
|
||||
|
||||
hideOtherSidebarContent: false, // whether or not to hide other sidebar content
|
||||
|
||||
// To avoid search index collision
|
||||
// between multiple websites under the same domain
|
||||
namespace: 'website-1',
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
```
|
||||
|
||||
|
||||
### Google Analytics
|
||||
## Google Analytics
|
||||
|
||||
Install the plugin and configure the track id.
|
||||
|
||||
|
|
@ -48,87 +61,137 @@ Install the plugin and configure the track id.
|
|||
ga: 'UA-XXXXX-Y'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
```
|
||||
|
||||
Configure by `data-ga`.
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js" data-ga="UA-XXXXX-Y"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
```
|
||||
|
||||
## emoji
|
||||
|
||||
The default is to support parsing emoji. For example `:100:` will be parsed to :100:. But it is not precise because there is no matching non-emoji string. If you need to correctly parse the emoji string, you need install this plugin.
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify" data-ga="UA-XXXXX-Y"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
|
||||
```
|
||||
|
||||
## External Script
|
||||
|
||||
## Write a plugin
|
||||
If the script on the page is an external one (imports a js file via `src` attribute), you'll need this plugin to make it work.
|
||||
|
||||
A plugin is simply a function that takes `hook` as arguments.
|
||||
The hook supports handling asynchronous tasks.
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/plugins/external-script.min.js"></script>
|
||||
```
|
||||
|
||||
#### Full configuration
|
||||
## Zoom image
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.init(function() {
|
||||
// Called when the script starts running, only trigger once, no arguments,
|
||||
})
|
||||
Medium's image zoom. Based on [medium-zoom](https://github.com/francoischalifour/medium-zoom).
|
||||
|
||||
hook.beforeEach(function(content) {
|
||||
// Invoked each time before parsing the Markdown file.
|
||||
// ...
|
||||
return content
|
||||
})
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
|
||||
```
|
||||
|
||||
hook.afterEach(function(html, next) {
|
||||
// Invoked each time after the Markdown file is parsed.
|
||||
// beforeEach and afterEach support asynchronous。
|
||||
// ...
|
||||
// call `next(html)` when task is done.
|
||||
next(html)
|
||||
})
|
||||
Exclude the special image
|
||||
|
||||
hook.doneEach(function() {
|
||||
// Invoked each time after the data is fully loaded, no arguments,
|
||||
// ...
|
||||
})
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
hook.mounted(function() {
|
||||
// Called after initial completion. Only trigger once, no arguments.
|
||||
})
|
||||
## Edit on github
|
||||
|
||||
hook.ready(function() {
|
||||
// Called after initial completion, no arguments.
|
||||
})
|
||||
Add `Edit on github` button on every pages. Provided by [@njleonzhang](https://github.com/njleonzhang), check [document](https://github.com/njleonzhang/docsify-edit-on-github)
|
||||
|
||||
## Demo code with instant preview and jsfiddle integration
|
||||
|
||||
With this plugin, sample code can be rendered on the page instantly, so that the readers can see the preview immediately.
|
||||
When readers expand the demo box, the source code and description are shown there. if they click the button `Try in Jsfiddle`,
|
||||
`jsfiddle.net` will be open with the code of this sample, which allow readers to revise the code and try on their own.
|
||||
|
||||
[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported.
|
||||
|
||||
## Copy to Clipboard
|
||||
|
||||
Add a simple `Click to copy` button to all preformatted code blocks to effortlessly allow users to copy example code from your docs. Provided by [@jperasmus](https://github.com/jperasmus)
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify-copy-code"></script>
|
||||
```
|
||||
|
||||
See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details.
|
||||
|
||||
## Disqus
|
||||
|
||||
Disqus comments. https://disqus.com/
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
disqus: 'shortname'
|
||||
}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/disqus.min.js"></script>
|
||||
```
|
||||
|
||||
!> You can get internal methods through `window.Docsify`. Get the current instance through the second argument.
|
||||
## Gitalk
|
||||
|
||||
#### Example
|
||||
[Gitalk](https://github.com/gitalk/gitalk) is a modern comment component based on Github Issue and Preact.
|
||||
|
||||
Add footer component in each pages.
|
||||
```html
|
||||
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
|
||||
|
||||
<script src="//unpkg.com/docsify/lib/plugins/gitalk.min.js"></script>
|
||||
<script src="//unpkg.com/gitalk/dist/gitalk.min.js"></script>
|
||||
<script>
|
||||
const gitalk = new Gitalk({
|
||||
clientID: 'Github Application Client ID',
|
||||
clientSecret: 'Github Application Client Secret',
|
||||
repo: 'Github repo',
|
||||
owner: 'Github repo owner',
|
||||
admin: ['Github repo collaborators, only these guys can initialize github issues'],
|
||||
// facebook-like distraction free mode
|
||||
distractionFreeMode: false
|
||||
})
|
||||
</script>
|
||||
```
|
||||
|
||||
## Pagination
|
||||
|
||||
Pagination for docsify. By [@imyelo](https://github.com/imyelo)
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
|
||||
```
|
||||
|
||||
## codefund
|
||||
|
||||
a [plugin](https://github.com/njleonzhang/docsify-plugin-codefund) to make it easy to join up [codefund](https://codefund.io/)
|
||||
|
||||
> codefund is formerly known as "codesponsor"
|
||||
|
||||
```
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
function (hook) {
|
||||
var footer = [
|
||||
'<hr/>',
|
||||
'<footer>',
|
||||
'<span><a href="https://github.com/QingWei-Li">cinwell</a> ©2017.</span>',
|
||||
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
|
||||
'</footer>'
|
||||
].join('')
|
||||
|
||||
hook.afterEach(function (html) {
|
||||
return html + footer
|
||||
})
|
||||
}
|
||||
DocsifyCodefund.create('xxxx-xxx-xxx') // change to your codefund id
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Tabs
|
||||
|
||||
A docsify.js plugin for displaying tabbed content from markdown.
|
||||
|
||||
- [Documentation & Demos](https://jhildenbiddle.github.io/docsify-tabs)
|
||||
|
||||
Provided by [@jhildenbiddle](https://github.com/jhildenbiddle/docsify-tabs).
|
||||
|
||||
## More plugins
|
||||
|
||||
See [awesome-docsify](awesome?id=plugins)
|
||||
|
|
|
|||
115
docs/pwa.md
Normal file
115
docs/pwa.md
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
# Offline Mode
|
||||
|
||||
[Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/) (PWA) are experiences that combine the best of the web with the best of apps. We can enhance our website with service workers to work **offline** or on low-quality networks.
|
||||
|
||||
It is also very easy to use it.
|
||||
|
||||
## Create serviceWorker
|
||||
|
||||
Create a `sw.js` file in your documents root directory and copy the following code:
|
||||
|
||||
*sw.js*
|
||||
|
||||
```js
|
||||
/* ===========================================================
|
||||
* docsify sw.js
|
||||
* ===========================================================
|
||||
* Copyright 2016 @huxpro
|
||||
* Licensed under Apache 2.0
|
||||
* Register service worker.
|
||||
* ========================================================== */
|
||||
|
||||
const RUNTIME = 'docsify'
|
||||
const HOSTNAME_WHITELIST = [
|
||||
self.location.hostname,
|
||||
'fonts.gstatic.com',
|
||||
'fonts.googleapis.com',
|
||||
'unpkg.com'
|
||||
]
|
||||
|
||||
// The Util Function to hack URLs of intercepted requests
|
||||
const getFixedUrl = (req) => {
|
||||
var now = Date.now()
|
||||
var url = new URL(req.url)
|
||||
|
||||
// 1. fixed http URL
|
||||
// Just keep syncing with location.protocol
|
||||
// fetch(httpURL) belongs to active mixed content.
|
||||
// And fetch(httpRequest) is not supported yet.
|
||||
url.protocol = self.location.protocol
|
||||
|
||||
// 2. add query for caching-busting.
|
||||
// Github Pages served with Cache-Control: max-age=600
|
||||
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
|
||||
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
|
||||
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
|
||||
if (url.hostname === self.location.hostname) {
|
||||
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
|
||||
}
|
||||
return url.href
|
||||
}
|
||||
|
||||
/**
|
||||
* @Lifecycle Activate
|
||||
* New one activated when old isnt being used.
|
||||
*
|
||||
* waitUntil(): activating ====> activated
|
||||
*/
|
||||
self.addEventListener('activate', event => {
|
||||
event.waitUntil(self.clients.claim())
|
||||
})
|
||||
|
||||
/**
|
||||
* @Functional Fetch
|
||||
* All network requests are being intercepted here.
|
||||
*
|
||||
* void respondWith(Promise<Response> r)
|
||||
*/
|
||||
self.addEventListener('fetch', event => {
|
||||
// Skip some of cross-origin requests, like those for Google Analytics.
|
||||
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
|
||||
// Stale-while-revalidate
|
||||
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
|
||||
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
|
||||
const cached = caches.match(event.request)
|
||||
const fixedUrl = getFixedUrl(event.request)
|
||||
const fetched = fetch(fixedUrl, { cache: 'no-store' })
|
||||
const fetchedCopy = fetched.then(resp => resp.clone())
|
||||
|
||||
// Call respondWith() with whatever we get first.
|
||||
// If the fetch fails (e.g disconnected), wait for the cache.
|
||||
// If there’s nothing in cache, wait for the fetch.
|
||||
// If neither yields a response, return offline pages.
|
||||
event.respondWith(
|
||||
Promise.race([fetched.catch(_ => cached), cached])
|
||||
.then(resp => resp || fetched)
|
||||
.catch(_ => { /* eat any errors */ })
|
||||
)
|
||||
|
||||
// Update the cache with the version we fetched (only for ok status)
|
||||
event.waitUntil(
|
||||
Promise.all([fetchedCopy, caches.open(RUNTIME)])
|
||||
.then(([response, cache]) => response.ok && cache.put(event.request, response))
|
||||
.catch(_ => { /* eat any errors */ })
|
||||
)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Register
|
||||
|
||||
Now, register it in your `index.html`. It only works on some modern browsers, so we need to judge:
|
||||
|
||||
*index.html*
|
||||
|
||||
```html
|
||||
<script>
|
||||
if (typeof navigator.serviceWorker !== 'undefined') {
|
||||
navigator.serviceWorker.register('sw.js')
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
## Enjoy it
|
||||
|
||||
Release your website and start experiencing magical offline feature. :ghost: You can turn off Wi-Fi and refresh the current site to experience it.
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
# Quick start
|
||||
|
||||
Recommended install `docsify-cli` globally, which can help us to initialize and preview the website locally.
|
||||
It is recommended to install `docsify-cli` globally, which helps initializing and previewing the website locally.
|
||||
|
||||
```bash
|
||||
npm i docsify-cli -g
|
||||
```
|
||||
|
||||
## initialize
|
||||
## Initialize
|
||||
|
||||
If you want to write the documentation in `./docs` directory, you can use the `init` command.
|
||||
If you want to write the documentation in the `./docs` subdirectory, you can use the `init` command.
|
||||
|
||||
```bash
|
||||
docsify init ./docs
|
||||
|
|
@ -16,65 +16,72 @@ docsify init ./docs
|
|||
|
||||
## Writing content
|
||||
|
||||
After the init is complete, you can see the file list in the docs directory.
|
||||
After the `init` is complete, you can see the file list in the `./docs` subdirectory.
|
||||
|
||||
* `index.html` as the entry file
|
||||
* `README.md` as the home page
|
||||
* `.nojekyll` prevents GitHub Pages from ignoring files that begin with an underscore
|
||||
|
||||
- `index.html` as the entry file
|
||||
- `README.md` as the home page
|
||||
- `.nojekyll` can prevent GitHub Pages from ignoring files that begin with an underscore
|
||||
|
||||
You can easily update the documentation in `docs/README.md`, of course you can add [more pages](more-pages).
|
||||
You can easily update the documentation in `./docs/README.md`, of course you can add [more pages](more-pages.md).
|
||||
|
||||
## Preview your site
|
||||
|
||||
Run the local server via `docsify serve`. You can preview your site in browser via http://localhost:3000.
|
||||
|
||||
Run the local server with `docsify serve`. You can preview your site in your browser on `http://localhost:3000`.
|
||||
|
||||
```bash
|
||||
docsify serve docs
|
||||
```
|
||||
|
||||
?> More usages of reference [docsify-cli documentation](https://github.com/QingWei-Li/docsify-cli).
|
||||
?> For more use cases of `docsify-cli`, head over to the [docsify-cli documentation](https://github.com/docsifyjs/docsify-cli).
|
||||
|
||||
## Manually
|
||||
## Manual initialization
|
||||
|
||||
If you don't like npm or feel the trouble to install the tool. What we need is an `index.html`.
|
||||
|
||||
*index.html*
|
||||
If you don't like `npm` or have trouble installing the tool, you can manually create `index.html`:
|
||||
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
//...
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
</body>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
</html>
|
||||
```
|
||||
|
||||
If your system has Python, you can easily to run a static server to preview your site.
|
||||
If you installed python on your system, you can easily use it to run a static server to preview your site.
|
||||
|
||||
```bash
|
||||
cd docs && python -m SimpleHTTPServer 3000
|
||||
```
|
||||
|
||||
## Loading tip
|
||||
## Loading dialog
|
||||
|
||||
Show `Loading...` Before starting rendering. You can customize the content.
|
||||
If you want, you can show a loading dialog before docsify starts to render your documentation:
|
||||
|
||||
*index.html*
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<div id="app">Please wait...</div>
|
||||
```
|
||||
|
||||
You should set the `data-app` attribute if you changed `el`.
|
||||
You should set the `data-app` attribute if you changed `el`:
|
||||
|
||||
*index.html*
|
||||
```html
|
||||
<!-- index.html -->
|
||||
|
||||
<div data-app id="main">Please wait...</div>
|
||||
|
||||
<script>
|
||||
|
|
@ -83,3 +90,5 @@ You should set the `data-app` attribute if you changed `el`.
|
|||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
Compare [el configuration](configuration.md#el).
|
||||
|
|
|
|||
124
docs/ssr.md
Normal file
124
docs/ssr.md
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
# Server-Side Rendering
|
||||
|
||||
See https://docsify.now.sh
|
||||
|
||||
Repo in https://github.com/docsifyjs/docsify-ssr-demo
|
||||
|
||||
## Why SSR?
|
||||
- Better SEO
|
||||
- Feeling cool
|
||||
|
||||
## Quick start
|
||||
|
||||
Install `now` and `docsify-cli` in your project.
|
||||
|
||||
```bash
|
||||
npm i now docsify-cli -D
|
||||
```
|
||||
|
||||
Edit `package.json`. If the documentation in `./docs` subdirectory.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-project",
|
||||
"scripts": {
|
||||
"start": "docsify start . -c ssr.config.js",
|
||||
"deploy": "now -p"
|
||||
},
|
||||
"files": [
|
||||
"docs"
|
||||
],
|
||||
"docsify": {
|
||||
"config": {
|
||||
"basePath": "https://docsify.js.org/",
|
||||
"loadSidebar": true,
|
||||
"loadNavbar": true,
|
||||
"coverpage": true,
|
||||
"name": "docsify"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
!> The `basePath` just like webpack `publicPath`. We can use local or remote files.
|
||||
|
||||
We can preview in the local to see if it works.
|
||||
|
||||
```bash
|
||||
npm start
|
||||
|
||||
# open http://localhost:4000
|
||||
```
|
||||
|
||||
Publish it!
|
||||
|
||||
```bash
|
||||
now -p
|
||||
```
|
||||
|
||||
Now, You have a support for SSR the docs site.
|
||||
|
||||
## Custom template
|
||||
|
||||
You can provide a template for entire page's HTML. such as
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css" title="vue">
|
||||
</head>
|
||||
<body>
|
||||
<!--inject-app-->
|
||||
<!--inject-config-->
|
||||
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
The template should contain these comments for rendered app content.
|
||||
- `<!--inject-app-->`
|
||||
- `<!--inject-config-->`
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure it in a special config file, or `package.json`.
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
template: './ssr.html',
|
||||
maxAge: 60 * 60 * 1000, // lru-cache config
|
||||
config: {
|
||||
// docsify config
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Deploy for your VPS
|
||||
|
||||
You can run `docsify start` directly on your Node server, or write your own server app with `docsify-server-renderer`.
|
||||
|
||||
```js
|
||||
var Renderer = require('docsify-server-renderer')
|
||||
var readFileSync = require('fs').readFileSync
|
||||
|
||||
// init
|
||||
var renderer = new Renderer({
|
||||
template: readFileSync('./docs/index.template.html', 'utf-8'),
|
||||
config: {
|
||||
name: 'docsify',
|
||||
repo: 'docsifyjs/docsify'
|
||||
}
|
||||
})
|
||||
|
||||
renderer.renderToString(url)
|
||||
.then(html => {})
|
||||
.catch(err => {})
|
||||
```
|
||||
|
|
@ -2,35 +2,43 @@
|
|||
|
||||
There are currently three themes available. Copy [Vue](//vuejs.org) and [buble](//buble.surge.sh) website custom theme and [@liril-net](https://github.com/liril-net) contribution to the theme of the black style.
|
||||
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/pure.css">
|
||||
```
|
||||
|
||||
!> This compressed files in `/lib/themes/`.
|
||||
!> Compressed files are available in `/lib/themes/`.
|
||||
|
||||
If you have any ideas or would like to develop new theme, welcome submit [PR](https://github.com/QingWei-Li/docsify/pulls).
|
||||
```html
|
||||
<!-- compressed -->
|
||||
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/pure.css">
|
||||
```
|
||||
|
||||
If you have any ideas or would like to develop a new theme, you are welcome to submit a [pull request](https://github.com/docsifyjs/docsify/pulls).
|
||||
|
||||
#### Click to preview
|
||||
|
||||
|
||||
<div class="demo-theme-preview">
|
||||
<a data-theme="vue">vue.css</a>
|
||||
<a data-theme="buble">buble.css</a>
|
||||
<a data-theme="dark">dark.css</a>
|
||||
<a data-theme="pure">pure.css</a>
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
.demo-theme-preview a {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.demo-theme-preview a:hover {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -46,3 +54,7 @@ If you have any ideas or would like to develop new theme, welcome submit [PR](ht
|
|||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
## Other themes
|
||||
|
||||
- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify.
|
||||
|
|
|
|||
36
docs/vue.md
36
docs/vue.md
|
|
@ -1,23 +1,25 @@
|
|||
# Compatible with Vue
|
||||
|
||||
You can write Vue components directly in the Markdown file, and it will be parsed.
|
||||
You can use this feature to write vue demo and documentation together.
|
||||
You can write Vue components directly in the Markdown file, and it will be parsed. You can use this feature to write vue demo and documentation together.
|
||||
|
||||
## Basic usage
|
||||
|
||||
Load the Vue in `index.html`.
|
||||
Load the Vue in `./index.html`.
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/vue"></script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
|
||||
<!-- Or use the compressed files -->
|
||||
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
Then you can immediately write Vue code at Markdown file.
|
||||
`new Vue({ el: '#main' })` script is executed by default to create instance.
|
||||
Then you can immediately write Vue code at Markdown file. `new Vue({ el: '#main' })` script is executed by default to create instance.
|
||||
|
||||
*README.md*
|
||||
|
||||
```markdown
|
||||
````markdown
|
||||
# Vue guide
|
||||
|
||||
`v-for` usage.
|
||||
|
|
@ -26,12 +28,12 @@ Then you can immediately write Vue code at Markdown file.
|
|||
<ul>
|
||||
<li v-for="i in 10">{{ i }}</li>
|
||||
</ul>
|
||||
``
|
||||
```
|
||||
|
||||
<ul>
|
||||
<li v-for="i in 10">{{ i }}</li>
|
||||
</ul>
|
||||
```
|
||||
````
|
||||
|
||||
You can manually initialize a Vue instance.
|
||||
|
||||
|
|
@ -40,7 +42,7 @@ You can manually initialize a Vue instance.
|
|||
```markdown
|
||||
# Vue demo
|
||||
|
||||
<div>hello {{ msg }}</div>
|
||||
<div id="main">hello {{ msg }}</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
|
|
@ -59,9 +61,18 @@ You can manually initialize a Vue instance.
|
|||
*index.html*
|
||||
|
||||
```html
|
||||
<!-- Inject CSS file -->
|
||||
<link rel="stylesheet" href="//unpkg.com/vuep/dist/vuep.css">
|
||||
|
||||
<!-- Inject JavaScript file -->
|
||||
<script src="//unpkg.com/vue"></script>
|
||||
<script src="//unpkg.com/vuep"></script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
|
||||
<!-- or use the compressed files -->
|
||||
<script src="//unpkg.com/vue/dist/vue.min.js"></script>
|
||||
<script src="//unpkg.com/vuep/dist/vuep.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
*README.md*
|
||||
|
|
@ -70,13 +81,13 @@ You can manually initialize a Vue instance.
|
|||
|
||||
<vuep template="#example"></vuep>
|
||||
|
||||
<script type="text/x-template" id="example">
|
||||
<script v-pre type="text/x-template" id="example">
|
||||
<template>
|
||||
<div>Hello, {{ name }}!</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
module.exports = {
|
||||
data: function () {
|
||||
return { name: 'Vue' }
|
||||
}
|
||||
|
|
@ -85,5 +96,4 @@ You can manually initialize a Vue instance.
|
|||
</script>
|
||||
```
|
||||
|
||||
?> Example Refer to the vuep [documentation](https://qingwei-li.github.io/vuep/).
|
||||
|
||||
?> Example Refer to the [Vuep documentation](https://qingwei-li.github.io/vuep/).
|
||||
|
|
|
|||
111
docs/write-a-plugin.md
Normal file
111
docs/write-a-plugin.md
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
# Write a plugin
|
||||
|
||||
A plugin is simply a function that takes `hook` as an argument. The hook supports handling of asynchronous tasks.
|
||||
|
||||
## Full configuration
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
function(hook, vm) {
|
||||
hook.init(function() {
|
||||
// Called when the script starts running, only trigger once, no arguments,
|
||||
});
|
||||
|
||||
hook.beforeEach(function(content) {
|
||||
// Invoked each time before parsing the Markdown file.
|
||||
// ...
|
||||
return content;
|
||||
});
|
||||
|
||||
hook.afterEach(function(html, next) {
|
||||
// Invoked each time after the Markdown file is parsed.
|
||||
// beforeEach and afterEach support asynchronous。
|
||||
// ...
|
||||
// call `next(html)` when task is done.
|
||||
next(html);
|
||||
});
|
||||
|
||||
hook.doneEach(function() {
|
||||
// Invoked each time after the data is fully loaded, no arguments,
|
||||
// ...
|
||||
});
|
||||
|
||||
hook.mounted(function() {
|
||||
// Called after initial completion. Only trigger once, no arguments.
|
||||
});
|
||||
|
||||
hook.ready(function() {
|
||||
// Called after initial completion, no arguments.
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
!> You can get internal methods through `window.Docsify`. Get the current instance through the second argument.
|
||||
|
||||
## Example
|
||||
|
||||
#### footer
|
||||
|
||||
Add footer component in each pages.
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
function(hook) {
|
||||
var footer = [
|
||||
'<hr/>',
|
||||
'<footer>',
|
||||
'<span><a href="https://github.com/QingWei-Li">cinwell</a> ©2017.</span>',
|
||||
'<span>Proudly published with <a href="https://github.com/docsifyjs/docsify" target="_blank">docsify</a>.</span>',
|
||||
'</footer>'
|
||||
].join('');
|
||||
|
||||
hook.afterEach(function(html) {
|
||||
return html + footer;
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
### Edit Button
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
function(hook, vm) {
|
||||
hook.beforeEach(function(html) {
|
||||
var url =
|
||||
'https://github.com/docsifyjs/docsify/blob/master/docs/' +
|
||||
vm.route.file;
|
||||
var editHtml = '[📝 EDIT DOCUMENT](' + url + ')\n';
|
||||
|
||||
return (
|
||||
editHtml +
|
||||
html +
|
||||
'\n----\n' +
|
||||
'Last modified {docsify-updated} ' +
|
||||
editHtml
|
||||
);
|
||||
});
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
## Tips
|
||||
|
||||
### Get docsify version
|
||||
|
||||
```
|
||||
console.log(window.Docsify.version)
|
||||
```
|
||||
|
||||
Current version: <span id='tip-version'>loading</span>
|
||||
|
||||
<script>
|
||||
document.getElementById('tip-version').innerText = Docsify.version
|
||||
</script>
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
## docsify
|
||||
|
||||
> 一个神奇的文档网站生成工具
|
||||
|
||||
## 是什么
|
||||
|
||||
docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo 的地方是它不会生成将 `.md` 转成 `.html` 文件,所有转换工作都是在运行时进行。
|
||||
|
||||
这将非常实用,如果只是需要快速的搭建一个小型的文档网站,或者不想因为生成的一堆 `.html` 文件“污染” commit 记录,只需要创建一个 `index.html` 就可以开始写文档而且直接[部署在 GitHub Pages](zh-cn/deploy)。
|
||||
|
||||
查看[快速开始](zh-cn/quickstart)了解详情。
|
||||
|
||||
## 特性
|
||||
- 无需构建,写完文档直接发布
|
||||
- 容易使用并且轻量 (~14kB gzipped)
|
||||
- 智能的全文搜索
|
||||
- 提供多套主题
|
||||
- 丰富的 API
|
||||
- 兼容 IE10+
|
||||
|
||||
## 例子
|
||||
|
||||
可以查看 [Showcase](https://github.com/QingWei-Li/docsify/#showcase) 来了解使用 docsify 的文档项目。
|
||||
|
||||
## 捐赠
|
||||
|
||||
如果你觉得 docsify 对你有帮助,或者想对我微小的工作一点资瓷,欢迎给我[捐赠](https://github.com/QingWei-Li/donate)。
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
- 入门
|
||||
- [快速开始](zh-cn/quickstart)
|
||||
- [多页文档](zh-cn/more-pages)
|
||||
- [定制导航栏](zh-cn/custom-navbar)
|
||||
- [封面](zh-cn/cover)
|
||||
|
||||
- 定制化
|
||||
- [配置项](zh-cn/configuration)
|
||||
- [主题](zh-cn/themes)
|
||||
- [使用插件](zh-cn/plugins)
|
||||
- [Markdown 配置](zh-cn/markdown)
|
||||
- [代码高亮](zh-cn/language-highlight)
|
||||
|
||||
- 指南
|
||||
- [部署](zh-cn/deploy)
|
||||
- [文档助手](zh-cn/helpers)
|
||||
- [兼容 Vue](zh-cn/vue)
|
||||
- [CDN](zh-cn/cdn)
|
||||
|
||||
- [Changelog](zh-cn/changelog)
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
# CDN
|
||||
|
||||
推荐使用 [unpkg](//unpkg.com) —— 能及时获取到最新版。
|
||||
|
||||
## 获取最新版本
|
||||
|
||||
根据 UNPKG 的规则,不指定特定版本号时将引入最新版。
|
||||
|
||||
```html
|
||||
<!-- 引入 css -->
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
|
||||
<!-- 引入 script -->
|
||||
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
|
||||
```
|
||||
|
||||
## 获取指定版本
|
||||
|
||||
如果担心频繁地版本更新又可能引入未知 Bug,我们也可以使用具体的版本。规则是 `//unpkg.com/docsify@VERSION/`
|
||||
|
||||
```html
|
||||
<!-- 引入 css -->
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify@2.0.0/themes/vue.css">
|
||||
|
||||
<!-- 引入 script -->
|
||||
<script src="//unpkg.com/docsify@2.0.0/lib/docsify.js"></script>
|
||||
```
|
||||
|
||||
!> 指定 *VERSION* 为 `latest` 可以强制每次都请求最新版本。
|
||||
|
||||
## 压缩版
|
||||
|
||||
CSS 的压缩文件位于 `/lib/themes/` 目录下
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
|
||||
```
|
||||
|
||||
JS 的压缩文件是原有文件路径的基础上加 `.min`后缀
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
```
|
||||
|
||||
## 其他 CDN
|
||||
|
||||
[jsDelivr](http://www.jsdelivr.com/projects/docsify) 也是可用的,具体用法参考其文档。
|
||||
|
||||
|
|
@ -1,300 +0,0 @@
|
|||
# 配置项
|
||||
|
||||
docsify 有两种配置参数的方式。一种是配置在 `window.$docsify` 里,另一种是给 `script` 标签添加 `data-*` 属性。
|
||||
|
||||
```html
|
||||
<!-- 方法 1 -->
|
||||
<script>
|
||||
window.$docsify = {
|
||||
repo: 'QingWei-Li/docsify',
|
||||
maxLevel: 3,
|
||||
coverpage: true
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- 方法 2 -->
|
||||
<script
|
||||
src="//unpkg.com/docsify"
|
||||
data-repo="QingWei-Li/docsify"
|
||||
data-max-level="3"
|
||||
data-coverpage>
|
||||
</script>
|
||||
```
|
||||
|
||||
两种方式可以共存,推荐第一种做法——直接配置 `window.$docsify` 对象——这会让你的配置更加清晰,同时也可以方便的将配置单独写到另一个文件里。
|
||||
|
||||
!> 通过 `window.$docsify` 配置属性,需要将属性改成驼峰命名法。通过 `data-*` 属性配置,保持短横线的命名规则。
|
||||
|
||||
|
||||
## el
|
||||
|
||||
- 类型:`String`
|
||||
- 默认值:`#app`
|
||||
|
||||
docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#app` 如果不存在就直接绑定在 `body` 上。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
el: '#app'
|
||||
}
|
||||
```
|
||||
|
||||
## repo
|
||||
|
||||
- 类型:`String`
|
||||
- 默认值: `null`
|
||||
|
||||
配置仓库地址或者 `username/repo` 的字符串,会在页面右上角渲染一个 [GitHub Corner](http://tholman.com/github-corners/) 挂件。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
repo: 'QingWei-Li/docsify',
|
||||
// or
|
||||
repo: 'https://github.com/QingWei-Li/docsify/'
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## max-level
|
||||
|
||||
- 类型:`Number`
|
||||
- 默认值: `6`
|
||||
|
||||
默认情况下会抓取文档中所有标题渲染成目录,可配置最大支持渲染的标题层级。
|
||||
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
maxLevel: 4
|
||||
}
|
||||
```
|
||||
|
||||
## load-navbar
|
||||
|
||||
- 类型:`Boolean|String`
|
||||
- 默认值: `false`
|
||||
|
||||
加载自定义导航栏,参考[定制导航栏](zh-cn/custom-navbar) 了解用法。设置为 `true` 后会加载 `_navbar.md` 文件,也可以自定义加载的文件名。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
// 加载 _navbar.md
|
||||
loadNavbar: true,
|
||||
|
||||
// 加载 nav.md
|
||||
loadNavbar: 'nav.md'
|
||||
}
|
||||
```
|
||||
|
||||
## load-sidebar
|
||||
|
||||
- 类型:`Boolean|String`
|
||||
- 默认值: `false`
|
||||
|
||||
加载自定义侧边栏,参考[多页文档](zh-cn/more-pages)。设置为 `true` 后会加载 `_sidebar.md` 文件,也可以自定义加载的文件名。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
// 加载 _sidebar.md
|
||||
loadSidebar: true,
|
||||
|
||||
// 加载 summary.md
|
||||
loadSidebar: 'summary.md'
|
||||
}
|
||||
```
|
||||
|
||||
## sub-max-level
|
||||
|
||||
- 类型:`Number`
|
||||
- 默认值: `0`
|
||||
|
||||
自定义侧边栏后默认不会再生成目录,你也可以通过设置生成目录的最大层级开启这个功能。
|
||||
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
subMaxLevel: 2
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## auto2top
|
||||
|
||||
- 类型:`Boolean`
|
||||
- 默认值: `false`
|
||||
|
||||
切换页面后是否自动跳转到页面顶部。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
auto2top: true
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## homepage
|
||||
|
||||
- 类型:`String`
|
||||
- 默认值: `README.md`
|
||||
|
||||
设置首页文件加载路径。适合不想将 `README.md` 作为入口文件渲染,或者是文档存放在其他位置的情况使用。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
// 入口文件改为 /home.md
|
||||
homepage: 'home.md',
|
||||
|
||||
// 文档和仓库根目录下的 README.md 内容一致
|
||||
homepage: 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/README.md'
|
||||
}
|
||||
```
|
||||
|
||||
## base-path
|
||||
|
||||
- 类型:`String`
|
||||
|
||||
文档加载的根路径,可以是二级路径或者是其他域名的路径。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
basePath: '/path/',
|
||||
|
||||
// 直接渲染其他域名的文档
|
||||
basePath: 'https://docsify.js.org/',
|
||||
|
||||
// 甚至直接渲染其他仓库 readme
|
||||
basePath: 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/'
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## coverpage
|
||||
|
||||
- 类型:`Boolean|String`
|
||||
- 默认值: `false`
|
||||
|
||||
启用[封面页](/zh-cn/cover)。开启后是加载 `_coverpage.md` 文件,也可以自定义文件名。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
coverpage: true,
|
||||
|
||||
// 自定义文件名
|
||||
coverpage: 'cover.md'
|
||||
}
|
||||
```
|
||||
|
||||
## name
|
||||
|
||||
- 类型:`String`
|
||||
|
||||
|
||||
文档标题,会显示在侧边栏顶部。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
name: 'docsify'
|
||||
}
|
||||
```
|
||||
|
||||
## name-link
|
||||
|
||||
- 类型:`String`
|
||||
- 默认值:`window.location.pathname`
|
||||
|
||||
点击文档标题后跳转的链接地址。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
nameLink: '/'
|
||||
}
|
||||
```
|
||||
|
||||
## markdown
|
||||
|
||||
- 类型: `Object|Function`
|
||||
|
||||
参考 [Markdown 配置](/zh-cn/markdown)。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
// object
|
||||
markdown: {
|
||||
smartypants: true,
|
||||
renderer: {
|
||||
link: function() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// function
|
||||
markdown: function (marked, renderer) {
|
||||
// ...
|
||||
return marked
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## theme-color
|
||||
|
||||
- 类型:`String`
|
||||
|
||||
替换主题色。利用 [CSS3 支持变量](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables)的特性,对于老的浏览器有 polyfill 处理。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
themeColor: '#3F51B5'
|
||||
}
|
||||
```
|
||||
|
||||
## alias
|
||||
|
||||
- 类型:`Object`
|
||||
|
||||
定义路由别名,可以更自由的定义路由规则。
|
||||
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## auto-header
|
||||
|
||||
- 类型:`Boolean`
|
||||
|
||||
同时设置 `loadSidebar` 和 `autoHeader` 后,可以根据 `_sidebar.md` 的内容自动为每个页面增加标题。[#78](https://github.com/QingWei-Li/docsify/issues/78)
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
loadSidebar: true,
|
||||
autoHeader: true
|
||||
}
|
||||
```
|
||||
|
||||
## execute-script
|
||||
|
||||
- 类型:`Boolean`
|
||||
|
||||
执行文档里的 script 标签里的脚本,只执行第一个 script ([demo](zh-cn/themes))。 如果 Vue 存在,则自动开启。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
executeScript: true
|
||||
}
|
||||
```
|
||||
|
||||
```markdown
|
||||
## This is test
|
||||
|
||||
<script>
|
||||
console.log(2333)
|
||||
</script>
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
# 封面
|
||||
|
||||
通过设置 `coverpage` 参数,可以开启渲染封面的功能。具体用法见[配置项#coverpage](zh-cn/configuration#coverpage)。
|
||||
|
||||
## 基本用法
|
||||
|
||||
封面的生成同样是从 markdown 文件渲染来的。开启渲染封面功能后在文档根目录创建 `_coverpage.md` 文件。渲染效果如本文档。
|
||||
|
||||
*index.html*
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
coverpage: true
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
```
|
||||
|
||||
*_coverpage.md*
|
||||
|
||||
```markdown
|
||||

|
||||
|
||||
# docsify
|
||||
|
||||
> A magical documentation site generator.
|
||||
|
||||
- Simple and lightweight (~12kb gzipped)
|
||||
- Multiple themes
|
||||
- Not build static html files
|
||||
|
||||
|
||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||
[Get Started](#quick-start)
|
||||
```
|
||||
|
||||
|
||||
|
||||
!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。
|
||||
|
||||
## 自定义背景
|
||||
|
||||
目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。
|
||||
|
||||
*_coverpage.md*
|
||||
|
||||
```markdown
|
||||
# docsify
|
||||
|
||||
[GitHub](https://github.com/QingWei-Li/docsify/)
|
||||
[Get Started](#quick-start)
|
||||
|
||||
<!-- 背景图片 -->
|
||||

|
||||
<!-- 背景色 -->
|
||||

|
||||
```
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
# 自定义导航栏
|
||||
|
||||
我们可以直接在 HTML 里定义导航栏,要注意链接要以 `#/` 开头。
|
||||
|
||||
*index.html*
|
||||
|
||||
```html
|
||||
<body>
|
||||
<nav>
|
||||
<a href="#/">EN</a>
|
||||
<a href="#/zh-cn/">中文</a>
|
||||
</nav>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
```
|
||||
|
||||
|
||||
## 配置文件
|
||||
|
||||
那我们可以通过 Markdown 文件来配置导航。首先配置 `loadNavbar`,默认加载的文件为 `_navbar.md`。具体配置规则见[配置项#load-navbar](zh-cn/configuration#load-navbar)。
|
||||
|
||||
*index.html*
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadNavbar: true
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
```
|
||||
|
||||
*_navbar.md*
|
||||
|
||||
```markdown
|
||||
- [En](/)
|
||||
- [中文](/zh-cn/)
|
||||
```
|
||||
|
||||
`_navbar.md` 加载逻辑和 `sidebar` 文件一致,从每层目录下获取。例如当前路由为 `/zh-cn/custom-navbar` 那么是从 `/zh-cn/_navbar.md` 获取导航栏。
|
||||
|
||||
## 嵌套
|
||||
|
||||
如果导航内容过多,可以写成嵌套的列表,会被渲染成下拉列表的形式。
|
||||
|
||||
*_navbar.md*
|
||||
|
||||
|
||||
```markdown
|
||||
- 基础
|
||||
- [快速开始](zh-cn/quickstart)
|
||||
- [多页文档](zh-cn/more-pages)
|
||||
- [定制导航栏](zh-cn/custom-navbar)
|
||||
- [封面](zh-cn/cover)
|
||||
|
||||
- 配置
|
||||
- [配置项](zh-cn/configuration)
|
||||
- [主题](zh-cn/themes)
|
||||
- [使用插件](zh-cn/plugins)
|
||||
- [Markdown 配置](zh-cn/markdown)
|
||||
- [代码高亮](zh-cn/language-highlight)
|
||||
```
|
||||
|
||||
效果图
|
||||
|
||||

|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# 部署
|
||||
|
||||
和 GitBook 生成的文档一样,我们可以直接把文档网站部署到 GitHub Pages 或者 VPS 上。
|
||||
|
||||
## GitHub Pages
|
||||
|
||||
GitHub Pages 支持从三个地方读取文件
|
||||
- `docs/` 目录
|
||||
- master 分支
|
||||
- gh-pages 分支
|
||||
|
||||
我们推荐直接将文档放在 `docs/` 目录下,在设置页面开启 **GitHub Pages** 功能并选择 `master branch /docs folder` 选项。
|
||||
|
||||

|
||||
|
||||
!> 可以将文档放在根目录下,然后选择 **master 分支** 作为文档目录。
|
||||
|
||||
## VPS
|
||||
|
||||
和部署所有静态网站一样,只需将服务器的访问根目录设定为 `index.html` 文件。
|
||||
|
||||
例如 nginx 的配置
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your.domain.com;
|
||||
|
||||
location / {
|
||||
alias /path/to/dir/of/docs;
|
||||
index index.html;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# 文档助手
|
||||
|
||||
docsify 扩展了一些 Markdown 语法,可以让文档更易读。
|
||||
|
||||
|
||||
## 强调内容
|
||||
|
||||
适合显示重要的提示信息,语法为 `!> 内容`。
|
||||
|
||||
```markdown
|
||||
!> 一段重要的内容,可以和其他 **Markdown** 语法混用。
|
||||
```
|
||||
|
||||
!> 一段重要的内容,可以和其他 **Markdown** 语法混用。
|
||||
|
||||
|
||||
## 普通提示
|
||||
|
||||
普通的提示信息,比如写 TODO 或者参考内容等。
|
||||
|
||||
```markdown
|
||||
?> *TODO* 完善示例
|
||||
```
|
||||
|
||||
?> *TODO* 完善示例
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# 代码高亮
|
||||
|
||||
内置的代码高亮工具是 [Prism](https://github.com/PrismJS/prism),默认支持 CSS、JavaScript 和 HTML。如果需要高亮其语言——例如 PHP——可以手动引入代码高亮插件。
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-php.js"></script>
|
||||
```
|
||||
|
||||
?> 其他的语言高亮插件可以查看[Prims 仓库](https://github.com/PrismJS/prism/tree/gh-pages/components)。
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
# Markdown 配置
|
||||
|
||||
内置的 Markdown 解析器是 [marked](https://github.com/chjj/marked),可以修改它的配置。同时可以直接配置 `renderer`。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
markdown: {
|
||||
smartypants: true,
|
||||
renderer: {
|
||||
link: function() {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
?> 完整配置参数参考 [marked 文档](https://github.com/chjj/marked#options-1)
|
||||
|
||||
当然也可以完全定制 Markdown 解析规则。
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
markdown: function(marked, renderer) {
|
||||
// ...
|
||||
|
||||
return marked
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
# 多页文档
|
||||
|
||||
如果需要创建多个页面,或者需要多级路由的网站,在 docsify 里也能很容易的实现。例如创建一个 `guide.md` 文件,那么对应的路由就是 `/#/guide`。
|
||||
|
||||
假设你的目录结构如下:
|
||||
|
||||
```text
|
||||
-| docs/
|
||||
-| README.md
|
||||
-| guide.md
|
||||
-| zh-cn/
|
||||
-| README.md
|
||||
-| guide.md
|
||||
```
|
||||
|
||||
那么对应的访问页面将是
|
||||
|
||||
```text
|
||||
docs/README.md => http://domain.com
|
||||
docs/guide.md => http://domain.com/guide
|
||||
docs/zh-cn/README.md => http://domain.com/zh-cn/
|
||||
docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
|
||||
```
|
||||
|
||||
## 定制侧边栏
|
||||
|
||||
默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。
|
||||
|
||||
首先配置 `loadSidebar` 选项,具体配置规则见[配置项#load-sidebar](zh-cn/configuration#load-sidebar)。
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadSidebar: true
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
```
|
||||
|
||||
接着创建 `_sidebar.md` 文件,内容如下
|
||||
|
||||
```markdown
|
||||
- [首页](zh-cn/)
|
||||
- [指南](zh-cn/guide)
|
||||
```
|
||||
|
||||
!> 需要在文档根目录创建 `.nojekyll` 命名的空文件,阻止 GitHub Pages 忽略命名是下划线开头的文件。
|
||||
|
||||
|
||||
`_sidebar.md` 的加载逻辑是从每层目录下获取文件,如果当前目录不存在该文件则回退到上一级目录。例如当前路径为 `/zh-cn/more-pages` 则从 `/zh-cn/_sidebar.md` 获取文件,如果不存在则从 `/_sidebar.md` 获取。
|
||||
|
||||
## 显示目录
|
||||
|
||||
自定义侧边栏同时也可以开启目录功能。设置 `subMaxLevel` 配置项,具体介绍见 [配置项#sub-max-level](zh-cn/configuration#sub-max-level)。
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
loadSidebar: true,
|
||||
subMaxLevel: 2
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
# 使用插件
|
||||
|
||||
## 内置插件
|
||||
|
||||
### 全文搜索 - Search
|
||||
|
||||
全文搜索插件会根据当前页面上的超链接获取文档内容,在 `localStorage` 内建立文档索引。默认过期时间为一天,当然我们可以自己指定需要缓存的文件列表或者配置过期时间。
|
||||
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
search: 'auto', // 默认值
|
||||
|
||||
search : [
|
||||
'/', // => /README.md
|
||||
'/guide', // => /guide.md
|
||||
'/get-started', // => /get-started.md
|
||||
'/zh-cn/', // => /zh-cn/README.md
|
||||
],
|
||||
|
||||
// 完整配置参数
|
||||
search: {
|
||||
maxAge: 86400000, // 过期时间,单位毫秒,默认一天
|
||||
paths: [], // or 'auto'
|
||||
placeholder: 'Type to search',
|
||||
|
||||
// 支持本地化
|
||||
placeholder: {
|
||||
'/zh-cn/': '搜索',
|
||||
'/': 'Type to search'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
|
||||
```
|
||||
|
||||
### 谷歌统计 - Google Analytics
|
||||
|
||||
需要配置 track id 才能使用。
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.$docsify = {
|
||||
ga: 'UA-XXXXX-Y'
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
|
||||
```
|
||||
|
||||
也可以通过 `data-ga` 配置 id。
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/docsify" data-ga="UA-XXXXX-Y"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
|
||||
```
|
||||
|
||||
## 自定义插件
|
||||
|
||||
docsify 提供了一套插件机制,其中提供的钩子(hook)支持处理异步逻辑,可以很方便的扩展功能。
|
||||
|
||||
#### 完整功能
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.init(function() {
|
||||
// 初始化时调用,只调用一次,没有参数。
|
||||
})
|
||||
|
||||
hook.beforeEach(function(content) {
|
||||
// 每次开始解析 Markdown 内容时调用
|
||||
// ...
|
||||
return content
|
||||
})
|
||||
|
||||
hook.afterEach(function(html, next) {
|
||||
// 解析成 html 后调用。beforeEach 和 afterEach 支持处理异步逻辑
|
||||
// ...
|
||||
// 异步处理完成后调用 next(html) 返回结果
|
||||
next(html)
|
||||
})
|
||||
|
||||
hook.doneEach(function() {
|
||||
// 每次路由切换时数据全部加载完成后调用,没有参数。
|
||||
// ...
|
||||
})
|
||||
|
||||
hook.mounted(function() {
|
||||
// 初始化完成后调用 ,只调用一次,没有参数。
|
||||
})
|
||||
|
||||
hook.ready(function() {
|
||||
// 初始化并第一次加完成数据后调用,没有参数。
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
!> 如果需要用 docsify 的内部方法,可以通过 `window.Docsify` 获取,通过 `vm` 获取当前实例。
|
||||
|
||||
#### 例子
|
||||
|
||||
给每个页面的末尾加上 `footer`
|
||||
|
||||
```js
|
||||
window.$docsify = {
|
||||
plugins: [
|
||||
function (hook) {
|
||||
var footer = [
|
||||
'<hr/>',
|
||||
'<footer>',
|
||||
'<span><a href="https://github.com/QingWei-Li">cinwell</a> ©2017.</span>',
|
||||
'<span>Proudly published with <a href="https://github.com/QingWei-Li/docsify" target="_blank">docsify</a>.</span>',
|
||||
'</footer>'
|
||||
].join('')
|
||||
|
||||
hook.afterEach(function (html) {
|
||||
return html + footer
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
# 快速开始
|
||||
|
||||
推荐安装 `docsify-cli` 工具,可以方便创建及本地预览文档网站。
|
||||
|
||||
```bash
|
||||
npm i docsify-cli -g
|
||||
```
|
||||
|
||||
## 初始化项目
|
||||
|
||||
如果想在项目的 `./docs` 目录里写文档,直接通过 `init` 初始化项目。
|
||||
|
||||
```bash
|
||||
docsify init ./docs
|
||||
```
|
||||
|
||||
## 开始写文档
|
||||
|
||||
初始化成功后,可以看到 `./docs` 目录下创建的几个文件
|
||||
|
||||
- `index.html` 入口文件
|
||||
- `README.md` 会做为主页内容渲染
|
||||
- `.nojekyll` 用于阻止 GitHub Pages 会忽略掉下划线开头的文件
|
||||
|
||||
直接编辑 `docs/README.md` 就能更新网站内容,当然也可以[写多个页面](zh-cn/more-pages)。
|
||||
|
||||
## 本地预览网站
|
||||
|
||||
运行一个本地服务器通过 `docsify serve` 可以方便的预览效果,而且提供 LiveReload 功能,可以让实时的预览。默认访问 http://localhost:3000 。
|
||||
|
||||
```bash
|
||||
docsify serve docs
|
||||
```
|
||||
|
||||
?> 更多命令行工具用法,参考 [docsify-cli 文档](https://github.com/QingWei-Li/docsify-cli)。
|
||||
|
||||
## 手动初始化
|
||||
|
||||
如果不喜欢 npm 或者觉得安装工具太麻烦,我们其实只需要直接创建一个 `index.html` 文件。
|
||||
|
||||
*index.html*
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
</html>
|
||||
```
|
||||
|
||||
如果系统里安装 Python 的话,也可以很轻易的启动一个静态服务器。
|
||||
|
||||
```bash
|
||||
cd docs && python -m SimpleHTTPServer 3000
|
||||
```
|
||||
|
||||
## Loading 提示
|
||||
|
||||
初始化时会显示 `Loading...` 内容,你可以自定义提示信息。
|
||||
|
||||
*index.html*
|
||||
```html
|
||||
<div id="app">加载中</div>
|
||||
```
|
||||
|
||||
如果更改了 `el` 的配置,需要将该元素加上 `data-app` 属性。
|
||||
|
||||
*index.html*
|
||||
```html
|
||||
<div data-app id="main">加载中</div>
|
||||
|
||||
<script>
|
||||
window.$docsify = {
|
||||
el: '#main'
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
# 主题
|
||||
|
||||
目前提供三套主题可供选择,模仿 [Vue](//vuejs.org) 和 [buble](//buble.surge.sh) 官网订制的主题样式。还有 [@liril-net](https://github.com/liril-net) 贡献的黑色风格的主题。
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/dark.css">
|
||||
```
|
||||
|
||||
!> CSS 的压缩文件位于 `/lib/themes/`
|
||||
|
||||
如果你有其他想法或者想开发别的主题,欢迎提 [PR](https://github.com/QingWei-Li/docsify/pulls)。
|
||||
|
||||
#### 点击切换主题
|
||||
|
||||
|
||||
<div class="demo-theme-preview">
|
||||
<a data-theme="vue">vue.css</a>
|
||||
<a data-theme="buble">buble.css</a>
|
||||
<a data-theme="dark">dark.css</a>
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
.demo-theme-preview a {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.demo-theme-preview a:hover {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
var preview = Docsify.dom.find('.demo-theme-preview');
|
||||
var themes = Docsify.dom.findAll('[rel="stylesheet"]');
|
||||
|
||||
preview.onclick = function (e) {
|
||||
var title = e.target.getAttribute('data-theme')
|
||||
|
||||
themes.forEach(function (theme) {
|
||||
theme.disabled = theme.title !== title
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
# 兼容 Vue
|
||||
|
||||
你可以直接在 Markdown 文件里写 Vue 代码,它将被执行。我们可以用它写一些 Vue 的 Demo 或者示例代码。
|
||||
|
||||
|
||||
## 基础用法
|
||||
|
||||
在 `index.html` 里引入 Vue。
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/vue"></script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
```
|
||||
|
||||
接着就可以愉快地在 Markdown 里写 Vue 了。默认会执行 `new Vue({ el: '#main' })` 创建示例。
|
||||
|
||||
*README.md*
|
||||
|
||||
```markdown
|
||||
# Vue 介绍
|
||||
|
||||
`v-for` 的用法
|
||||
|
||||
```html
|
||||
<ul>
|
||||
<li v-for="i in 10">{{ i }}</li>
|
||||
</ul>
|
||||
``
|
||||
|
||||
<ul>
|
||||
<li v-for="i in 10">{{ i }}</li>
|
||||
</ul>
|
||||
```
|
||||
|
||||
当然你也可以手动初始化 Vue,这样你可以自定义一些配置。
|
||||
|
||||
*README.md*
|
||||
|
||||
```markdown
|
||||
# Vue 的基本用法
|
||||
|
||||
<div>hello {{ msg }}</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#main',
|
||||
data: { msg: 'Vue' }
|
||||
})
|
||||
</script>
|
||||
```
|
||||
|
||||
!> 一个 Markdown 文件里只有第一个 `script` 标签内的内容会被执行。
|
||||
|
||||
## 搭配 Vuep 写 Playground
|
||||
|
||||
[Vuep](https://github.com/QingWei-Li/vuep) 是一个提供在线编辑和预览效果的 Vue 组件,搭配 docsify 可以直接在文档里写 Vue 的示例代码,支持 Vue component spec 和 JSX。
|
||||
|
||||
*index.html*
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/vue"></script>
|
||||
<script src="//unpkg.com/vuep"></script>
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
```
|
||||
|
||||
*README.md*
|
||||
```markdown
|
||||
# Vuep 使用
|
||||
|
||||
<vuep template="#example"></vuep>
|
||||
|
||||
<script type="text/x-template" id="example">
|
||||
<template>
|
||||
<div>Hello, {{ name }}!</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: function () {
|
||||
return { name: 'Vue' }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
```
|
||||
|
||||
?> 具体效果参考 [Vuep 文档](https://qingwei-li.github.io/vuep/)。
|
||||
84
index.html
Normal file
84
index.html
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<link rel="stylesheet" href="/themes/vue.css" title="vue">
|
||||
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
|
||||
<style>
|
||||
nav.app-nav li ul {
|
||||
min-width: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/awesome': 'https://raw.githubusercontent.com/docsifyjs/awesome-docsify/master/README.md',
|
||||
'.*?/changelog': 'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG.md',
|
||||
'/.*/_navbar.md': '/_navbar.md',
|
||||
'/zh-cn/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-zh/master/$1',
|
||||
'/de-de/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
|
||||
'/ru/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
|
||||
'/es/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1'
|
||||
},
|
||||
auto2top: true,
|
||||
basePath: '/docs/',
|
||||
coverpage: true,
|
||||
executeScript: true,
|
||||
loadSidebar: true,
|
||||
loadNavbar: true,
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
name: 'docsify',
|
||||
search: {
|
||||
noData: {
|
||||
'/de-de/': 'Keine Ergebnisse!',
|
||||
'/zh-cn/': '没有结果!',
|
||||
'/': 'No results!'
|
||||
},
|
||||
paths: 'auto',
|
||||
placeholder: {
|
||||
'/de-de/': 'Suche',
|
||||
'/zh-cn/': '搜索',
|
||||
'/': 'Search'
|
||||
}
|
||||
},
|
||||
formatUpdated: '{MM}/{DD} {HH}:{mm}',
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
if (/githubusercontent\.com/.test(vm.route.file)) {
|
||||
url = vm.route.file
|
||||
.replace('raw.githubusercontent.com', 'github.com')
|
||||
.replace(/\/master/, '/blob/master')
|
||||
} else {
|
||||
url = 'https://github.com/docsifyjs/docsify/blob/master/docs/' + vm.route.file
|
||||
}
|
||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||
|
||||
return editHtml
|
||||
+ html
|
||||
+ '\n\n----\n\n'
|
||||
+ '<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
|
||||
})
|
||||
},
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="/lib/docsify.js"></script>
|
||||
<script src="/lib/plugins/search.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
7
lerna.json
Normal file
7
lerna.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"lerna": "2.0.0-rc.5",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "0.0.0"
|
||||
}
|
||||
3459
lib/docsify.js
3459
lib/docsify.js
File diff suppressed because it is too large
Load diff
2
lib/docsify.min.js
vendored
2
lib/docsify.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,41 +0,0 @@
|
|||
this.D = this.D || {};
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// From https://github.com/egoist/vue-ga/blob/master/src/index.js
|
||||
function appendScript () {
|
||||
var script = document.createElement('script');
|
||||
script.async = true;
|
||||
script.src = 'https://www.google-analytics.com/analytics.js';
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
function init (id) {
|
||||
if (!window.ga) {
|
||||
appendScript();
|
||||
window.ga = window.ga || function () {
|
||||
(window.ga.q = window.ga.q || []).push(arguments);
|
||||
};
|
||||
window.ga.l = Number(new Date());
|
||||
window.ga('create', id, 'auto');
|
||||
}
|
||||
}
|
||||
|
||||
function collect () {
|
||||
init(window.$docsify.ga);
|
||||
window.ga('set', 'page', location.href);
|
||||
window.ga('send', 'pageview');
|
||||
}
|
||||
|
||||
var install = function (hook) {
|
||||
if (!window.$docsify.ga) {
|
||||
console.error('[Docsify] ga is required.');
|
||||
return
|
||||
}
|
||||
|
||||
hook.beforeEach(collect);
|
||||
};
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
|
||||
|
||||
}());
|
||||
1
lib/plugins/ga.min.js
vendored
1
lib/plugins/ga.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
this.D=this.D||{},function(){"use strict";function n(){var n=document.createElement("script");n.async=!0,n.src="https://www.google-analytics.com/analytics.js",document.body.appendChild(n)}function o(o){window.ga||(n(),window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=Number(new Date),window.ga("create",o,"auto"))}function i(){o(window.$docsify.ga),window.ga("set","page",location.href),window.ga("send","pageview")}var w=function(n){return window.$docsify.ga?void n.beforeEach(i):void console.error("[Docsify] ga is required.")};window.$docsify.plugins=[].concat(w,window.$docsify.plugins)}();
|
||||
|
|
@ -1,276 +0,0 @@
|
|||
this.D = this.D || {};
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var INDEXS = {};
|
||||
var helper;
|
||||
|
||||
function escapeHtml (string) {
|
||||
var entityMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
'\'': ''',
|
||||
'/': '/'
|
||||
};
|
||||
|
||||
return String(string).replace(/[&<>"'\/]/g, function (s) { return entityMap[s]; })
|
||||
}
|
||||
|
||||
function getAllPaths () {
|
||||
var paths = [];
|
||||
|
||||
helper.dom.findAll('a')
|
||||
.map(function (node) {
|
||||
var href = node.href;
|
||||
var originHref = node.getAttribute('href');
|
||||
var path = helper.route.parse(href).path;
|
||||
|
||||
if (path &&
|
||||
paths.indexOf(path) === -1 &&
|
||||
!helper.route.isAbsolutePath(originHref)) {
|
||||
paths.push(path);
|
||||
}
|
||||
});
|
||||
|
||||
return paths
|
||||
}
|
||||
|
||||
function saveData (maxAge) {
|
||||
localStorage.setItem('docsify.search.expires', Date.now() + maxAge);
|
||||
localStorage.setItem('docsify.search.index', JSON.stringify(INDEXS));
|
||||
}
|
||||
|
||||
function genIndex (path, content) {
|
||||
if ( content === void 0 ) content = '';
|
||||
|
||||
var tokens = window.marked.lexer(content);
|
||||
var toURL = Docsify.route.toURL;
|
||||
var index = {};
|
||||
var slug;
|
||||
|
||||
tokens.forEach(function (token) {
|
||||
if (token.type === 'heading' && token.depth <= 2) {
|
||||
slug = toURL(path, { id: token.text });
|
||||
index[slug] = { slug: slug, title: token.text, body: '' };
|
||||
} else {
|
||||
if (!slug) { return }
|
||||
if (!index[slug]) {
|
||||
index[slug] = { slug: slug, title: '', body: '' };
|
||||
} else {
|
||||
if (index[slug].body) {
|
||||
index[slug].body += '\n' + (token.text || '');
|
||||
} else {
|
||||
index[slug].body = token.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return index
|
||||
}
|
||||
|
||||
function search (keywords) {
|
||||
var matchingResults = [];
|
||||
var data = [];
|
||||
Object.keys(INDEXS).forEach(function (key) {
|
||||
data = data.concat(Object.keys(INDEXS[key]).map(function (page) { return INDEXS[key][page]; }));
|
||||
});
|
||||
|
||||
keywords = keywords.trim().split(/[\s\-\,\\/]+/);
|
||||
|
||||
var loop = function ( i ) {
|
||||
var post = data[i];
|
||||
var isMatch = false;
|
||||
var resultStr = '';
|
||||
var postTitle = post.title && post.title.trim();
|
||||
var postContent = post.body && post.body.trim();
|
||||
var postUrl = post.slug || '';
|
||||
|
||||
if (postTitle && postContent) {
|
||||
keywords.forEach(function (keyword, i) {
|
||||
var regEx = new RegExp(keyword, 'gi');
|
||||
var indexTitle = -1;
|
||||
var indexContent = -1;
|
||||
|
||||
indexTitle = postTitle && postTitle.search(regEx);
|
||||
indexContent = postContent && postContent.search(regEx);
|
||||
|
||||
if (indexTitle < 0 && indexContent < 0) {
|
||||
isMatch = false;
|
||||
} else {
|
||||
isMatch = true;
|
||||
if (indexContent < 0) { indexContent = 0; }
|
||||
|
||||
var start = 0;
|
||||
var end = 0;
|
||||
|
||||
start = indexContent < 11 ? 0 : indexContent - 10;
|
||||
end = start === 0 ? 70 : indexContent + keyword.length + 60;
|
||||
|
||||
if (end > postContent.length) { end = postContent.length; }
|
||||
|
||||
var matchContent = '...' +
|
||||
escapeHtml(postContent)
|
||||
.substring(start, end)
|
||||
.replace(regEx, ("<em class=\"search-keyword\">" + keyword + "</em>")) +
|
||||
'...';
|
||||
|
||||
resultStr += matchContent;
|
||||
}
|
||||
});
|
||||
|
||||
if (isMatch) {
|
||||
var matchingPost = {
|
||||
title: escapeHtml(postTitle),
|
||||
content: resultStr,
|
||||
url: postUrl
|
||||
};
|
||||
|
||||
matchingResults.push(matchingPost);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 0; i < data.length; i++) loop( i );
|
||||
|
||||
return matchingResults
|
||||
}
|
||||
|
||||
function init$1 (config, vm) {
|
||||
helper = Docsify;
|
||||
|
||||
var isAuto = config.paths === 'auto';
|
||||
var isExpired = localStorage.getItem('docsify.search.expires') < Date.now();
|
||||
|
||||
INDEXS = JSON.parse(localStorage.getItem('docsify.search.index'));
|
||||
|
||||
if (isExpired) {
|
||||
INDEXS = {};
|
||||
} else if (!isAuto) {
|
||||
return
|
||||
}
|
||||
|
||||
var paths = isAuto ? getAllPaths() : config.paths;
|
||||
var len = paths.length;
|
||||
var count = 0;
|
||||
|
||||
paths.forEach(function (path) {
|
||||
if (INDEXS[path]) { return count++ }
|
||||
|
||||
helper
|
||||
.get(vm.$getFile(path))
|
||||
.then(function (result) {
|
||||
INDEXS[path] = genIndex(path, result);
|
||||
len === ++count && saveData(config.maxAge);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var dom;
|
||||
|
||||
function style () {
|
||||
var code = "\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}";
|
||||
var style = dom.create('style', code);
|
||||
dom.appendTo(dom.head, style);
|
||||
}
|
||||
|
||||
function tpl (opts) {
|
||||
var html =
|
||||
"<input type=\"search\" />" +
|
||||
'<div class="results-panel"></div>' +
|
||||
'</div>';
|
||||
var el = dom.create('div', html);
|
||||
var aside = dom.find('aside');
|
||||
|
||||
dom.toggleClass(el, 'search');
|
||||
dom.before(aside, el);
|
||||
}
|
||||
|
||||
function bindEvents () {
|
||||
var $search = dom.find('div.search');
|
||||
var $input = dom.find($search, 'input');
|
||||
var $panel = dom.find($search, '.results-panel');
|
||||
var doSearch = function (value) {
|
||||
if (!value) {
|
||||
$panel.classList.remove('show');
|
||||
$panel.innerHTML = '';
|
||||
return
|
||||
}
|
||||
var matchs = search(value);
|
||||
|
||||
var html = '';
|
||||
matchs.forEach(function (post) {
|
||||
html += "<div class=\"matching-post\">\n <h2><a href=\"" + (post.url) + "\">" + (post.title) + "</a></h2>\n <p>" + (post.content) + "</p>\n</div>";
|
||||
});
|
||||
|
||||
$panel.classList.add('show');
|
||||
$panel.innerHTML = html || '<p class="empty">No Results!</p>';
|
||||
};
|
||||
|
||||
var timeId;
|
||||
// Prevent to Fold sidebar
|
||||
dom.on($search, 'click',
|
||||
function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); });
|
||||
dom.on($input, 'input', function (e) {
|
||||
clearTimeout(timeId);
|
||||
timeId = setTimeout(function (_) { return doSearch(e.target.value.trim()); }, 200);
|
||||
});
|
||||
}
|
||||
|
||||
function updatePlaceholder (text, path) {
|
||||
var $input = dom.getNode('.search input[type="search"]');
|
||||
|
||||
if (typeof text === 'string') {
|
||||
$input.placeholder = text;
|
||||
} else {
|
||||
var match = Object.keys(text).find(function (key) { return path.indexOf(key) > -1; });
|
||||
$input.placeholder = text[match];
|
||||
}
|
||||
}
|
||||
|
||||
function init$$1 (opts) {
|
||||
dom = Docsify.dom;
|
||||
style();
|
||||
tpl(opts);
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
function update (opts, vm) {
|
||||
updatePlaceholder(opts.placeholder, vm.route.path);
|
||||
}
|
||||
|
||||
var CONFIG = {
|
||||
placeholder: 'Type to search',
|
||||
paths: 'auto',
|
||||
maxAge: 86400000 // 1 day
|
||||
};
|
||||
|
||||
var install = function (hook, vm) {
|
||||
var util = Docsify.util;
|
||||
var opts = vm.config.search || CONFIG;
|
||||
|
||||
if (Array.isArray(opts)) {
|
||||
CONFIG.paths = opts;
|
||||
} else if (typeof opts === 'object') {
|
||||
CONFIG.paths = Array.isArray(opts.paths) ? opts.paths : 'auto';
|
||||
CONFIG.maxAge = util.isPrimitive(opts.maxAge) ? opts.maxAge : CONFIG.maxAge;
|
||||
CONFIG.placeholder = opts.placeholder || CONFIG.placeholder;
|
||||
}
|
||||
|
||||
var isAuto = CONFIG.paths === 'auto';
|
||||
|
||||
hook.mounted(function (_) {
|
||||
init$$1(CONFIG);
|
||||
!isAuto && init$1(CONFIG, vm);
|
||||
});
|
||||
hook.doneEach(function (_) {
|
||||
update(CONFIG, vm);
|
||||
isAuto && init$1(CONFIG, vm);
|
||||
});
|
||||
};
|
||||
|
||||
window.$docsify.plugins = [].concat(install, window.$docsify.plugins);
|
||||
|
||||
}());
|
||||
1
lib/plugins/search.min.js
vendored
1
lib/plugins/search.min.js
vendored
|
|
@ -1 +0,0 @@
|
|||
this.D=this.D||{},function(){"use strict";function e(e){var n={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/]/g,function(e){return n[e]})}function n(){var e=[];return d.dom.findAll("a").map(function(n){var t=n.href,r=n.getAttribute("href"),i=d.route.parse(t).path;i&&e.indexOf(i)===-1&&!d.route.isAbsolutePath(r)&&e.push(i)}),e}function t(e){localStorage.setItem("docsify.search.expires",Date.now()+e),localStorage.setItem("docsify.search.index",JSON.stringify(f))}function r(e,n){void 0===n&&(n="");var t,r=window.marked.lexer(n),i=Docsify.route.toURL,o={};return r.forEach(function(n){if("heading"===n.type&&n.depth<=2)t=i(e,{id:n.text}),o[t]={slug:t,title:n.text,body:""};else{if(!t)return;o[t]?o[t].body?o[t].body+="\n"+(n.text||""):o[t].body=n.text:o[t]={slug:t,title:"",body:""}}}),o}function i(n){var t=[],r=[];Object.keys(f).forEach(function(e){r=r.concat(Object.keys(f[e]).map(function(n){return f[e][n]}))}),n=n.trim().split(/[\s\-\,\\\/]+/);for(var i=function(i){var o=r[i],a=!1,s="",c=o.title&&o.title.trim(),l=o.body&&o.body.trim(),p=o.slug||"";if(c&&l&&(n.forEach(function(n,t){var r=new RegExp(n,"gi"),i=-1,o=-1;if(i=c&&c.search(r),o=l&&l.search(r),i<0&&o<0)a=!1;else{a=!0,o<0&&(o=0);var p=0,u=0;p=o<11?0:o-10,u=0===p?70:o+n.length+60,u>l.length&&(u=l.length);var d="..."+e(l).substring(p,u).replace(r,'<em class="search-keyword">'+n+"</em>")+"...";s+=d}}),a)){var u={title:e(c),content:s,url:p};t.push(u)}},o=0;o<r.length;o++)i(o);return t}function o(e,i){d=Docsify;var o="auto"===e.paths,a=localStorage.getItem("docsify.search.expires")<Date.now();if(f=JSON.parse(localStorage.getItem("docsify.search.index")),a)f={};else if(!o)return;var s=o?n():e.paths,c=s.length,l=0;s.forEach(function(n){return f[n]?l++:void d.get(i.$getFile(n)).then(function(i){f[n]=r(n,i),c===++l&&t(e.maxAge)})})}function a(){var e="\n.sidebar {\n padding-top: 0;\n}\n\n.search {\n margin-bottom: 20px;\n padding: 6px;\n border-bottom: 1px solid #eee;\n}\n\n.search .results-panel {\n display: none;\n}\n\n.search .results-panel.show {\n display: block;\n}\n\n.search input {\n outline: none;\n border: none;\n width: 100%;\n padding: 7px;\n line-height: 22px;\n font-size: 14px;\n}\n\n.search h2 {\n font-size: 17px;\n margin: 10px 0;\n}\n\n.search a {\n text-decoration: none;\n color: inherit;\n}\n\n.search .matching-post {\n border-bottom: 1px solid #eee;\n}\n\n.search .matching-post:last-child {\n border-bottom: 0;\n}\n\n.search p {\n font-size: 14px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n\n.search p.empty {\n text-align: center;\n}",n=h.create("style",e);h.appendTo(h.head,n)}function s(e){var n='<input type="search" /><div class="results-panel"></div></div>',t=h.create("div",n),r=h.find("aside");h.toggleClass(t,"search"),h.before(r,t)}function c(){var e,n=h.find("div.search"),t=h.find(n,"input"),r=h.find(n,".results-panel"),o=function(e){if(!e)return r.classList.remove("show"),void(r.innerHTML="");var n=i(e),t="";n.forEach(function(e){t+='<div class="matching-post">\n <h2><a href="'+e.url+'">'+e.title+"</a></h2>\n <p>"+e.content+"</p>\n</div>"}),r.classList.add("show"),r.innerHTML=t||'<p class="empty">No Results!</p>'};h.on(n,"click",function(e){return"A"!==e.target.tagName&&e.stopPropagation()}),h.on(t,"input",function(n){clearTimeout(e),e=setTimeout(function(e){return o(n.target.value.trim())},200)})}function l(e,n){var t=h.getNode('.search input[type="search"]');if("string"==typeof e)t.placeholder=e;else{var r=Object.keys(e).find(function(e){return n.indexOf(e)>-1});t.placeholder=e[r]}}function p(e){h=Docsify.dom,a(),s(e),c()}function u(e,n){l(e.placeholder,n.route.path)}var d,h,f={},g={placeholder:"Type to search",paths:"auto",maxAge:864e5},m=function(e,n){var t=Docsify.util,r=n.config.search||g;Array.isArray(r)?g.paths=r:"object"==typeof r&&(g.paths=Array.isArray(r.paths)?r.paths:"auto",g.maxAge=t.isPrimitive(r.maxAge)?r.maxAge:g.maxAge,g.placeholder=r.placeholder||g.placeholder);var i="auto"===g.paths;e.mounted(function(e){p(g),!i&&o(g,n)}),e.doneEach(function(e){u(g,n),i&&o(g,n)})};window.$docsify.plugins=[].concat(m,window.$docsify.plugins)}();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 9.6 KiB |
8914
package-lock.json
generated
Normal file
8914
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
97
package.json
97
package.json
|
|
@ -1,22 +1,78 @@
|
|||
{
|
||||
"name": "docsify",
|
||||
"version": "3.0.4",
|
||||
"version": "4.9.4",
|
||||
"description": "A magical documentation generator.",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
"email": "cinwell.li@gmail.com",
|
||||
"url": "https://github.com/QingWei-Li"
|
||||
},
|
||||
"homepage": "https://docsify.js.org",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/docsifyjs/docsify.git"
|
||||
},
|
||||
"main": "lib/docsify.js",
|
||||
"unpkg": "lib/docsify.min.js",
|
||||
"files": [
|
||||
"lib",
|
||||
"src",
|
||||
"themes"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rm -rf lib themes && node build/build.js && mkdir lib/themes && mkdir themes && node build/build-css.js",
|
||||
"dev:build": "rm -rf lib themes && mkdir themes && node build/build.js --dev && node build/build-css.js --dev",
|
||||
"dev": "node app.js & nodemon -w src -e js,css --exec 'npm run dev:build'",
|
||||
"test": "eslint src"
|
||||
"bootstrap": "npm i && lerna bootstrap && npm run build:ssr",
|
||||
"serve": "node server",
|
||||
"serve:ssr": "cross-env SSR=1 node server",
|
||||
"dev": "run-p serve watch:*",
|
||||
"dev:ssr": "run-p serve:ssr watch:*",
|
||||
"lint": "eslint {src,packages} --fix",
|
||||
"test": "mocha test/*/**",
|
||||
"css": "stylus src/themes/*.styl -u autoprefixer-stylus",
|
||||
"watch:css": "run-p 'css -- -o themes -w'",
|
||||
"watch:js": "node build/build.js",
|
||||
"build:css:min": "mkdir lib/themes && run-p 'css -- -o lib/themes' && node build/mincss.js",
|
||||
"build:css": "mkdir -p themes && run-p 'css -- -o themes'",
|
||||
"build:js": "cross-env NODE_ENV=production node build/build.js",
|
||||
"build:ssr": "node build/ssr.js",
|
||||
"build:cover": "node build/cover.js",
|
||||
"build": "rimraf lib themes/* && run-s build:js build:css build:css:min build:ssr build:cover",
|
||||
"pub:next": "cross-env RELEASE_TAG=next sh build/release.sh",
|
||||
"pub": "sh build/release.sh",
|
||||
"postinstall": "opencollective postinstall"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/QingWei-Li/docsify.git"
|
||||
"dependencies": {
|
||||
"marked": "^0.5.1",
|
||||
"medium-zoom": "^0.4.0",
|
||||
"opencollective": "^1.0.3",
|
||||
"prismjs": "^1.15.0",
|
||||
"tinydate": "^1.0.0",
|
||||
"tweezer.js": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer-stylus": "^0.14.0",
|
||||
"chai": "^4.2.0",
|
||||
"chokidar": "^2.0.2",
|
||||
"conventional-changelog-cli": "^1.3.5",
|
||||
"cross-env": "^5.1.3",
|
||||
"cssnano": "^3.10.0",
|
||||
"eslint": "^4.14.0",
|
||||
"eslint-config-xo-space": "^0.18.0",
|
||||
"esm": "^3.1.4",
|
||||
"jsdom": "^13.2.0",
|
||||
"lerna": "^2.5.1",
|
||||
"live-server": "^1.2.1",
|
||||
"mocha": "^5.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"rimraf": "^2.6.2",
|
||||
"rollup": "^0.53.3",
|
||||
"rollup-plugin-async": "^1.2.0",
|
||||
"rollup-plugin-buble": "^0.18.0",
|
||||
"rollup-plugin-commonjs": "^8.2.6",
|
||||
"rollup-plugin-node-resolve": "^3.0.0",
|
||||
"rollup-plugin-replace": "^2.0.0",
|
||||
"rollup-plugin-uglify": "^2.0.1",
|
||||
"stylus": "^0.54.5"
|
||||
},
|
||||
"keywords": [
|
||||
"doc",
|
||||
|
|
@ -25,26 +81,9 @@
|
|||
"creator",
|
||||
"generator"
|
||||
],
|
||||
"author": "qingwei-li <cinwell.li@gmail.com> (https://github.com/QingWei-Li)",
|
||||
"homepage": "https://docsify.js.org",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"cssnano": "^3.8.1",
|
||||
"eslint": "^3.10.2",
|
||||
"eslint-config-vue": "^2.0.1",
|
||||
"eslint-plugin-vue": "^1.0.0",
|
||||
"nodemon": "^1.11.0",
|
||||
"postcss": "^5.2.6",
|
||||
"postcss-salad": "^1.0.5",
|
||||
"rollup": "^0.41.1",
|
||||
"rollup-plugin-buble": "^0.15.0",
|
||||
"rollup-plugin-commonjs": "^7.0.0",
|
||||
"rollup-plugin-node-resolve": "^2.0.0",
|
||||
"rollup-plugin-uglify": "^1.0.1",
|
||||
"serve-static": "^1.11.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"marked": "^0.3.6",
|
||||
"prismjs": "^1.5.1"
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/docsify",
|
||||
"logo": "https://docsify.js.org/_media/icon.svg"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
packages/docsify-server-renderer/.gitignore
vendored
Normal file
4
packages/docsify-server-renderer/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
build.js
|
||||
node_modules
|
||||
*.log
|
||||
.git
|
||||
46
packages/docsify-server-renderer/README.md
Normal file
46
packages/docsify-server-renderer/README.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# docsify-server-renderer
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
yarn add docsify-server-renderer
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var Renderer = require('docsify-server-renderer')
|
||||
var readFileSync = require('fs').readFileSync
|
||||
|
||||
// init
|
||||
var renderer = new Renderer({
|
||||
template: readFileSync('./docs/index.template.html', 'utf-8').,
|
||||
config: {
|
||||
name: 'docsify',
|
||||
repo: 'docsifyjs/docsify'
|
||||
}
|
||||
})
|
||||
|
||||
renderer.renderToString(url)
|
||||
.then(html => {})
|
||||
.catch(err => {})
|
||||
```
|
||||
|
||||
*index.template.html*
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css" title="buble" disabled>
|
||||
</head>
|
||||
<body>
|
||||
<!--inject-app-->
|
||||
<!--inject-config-->
|
||||
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
181
packages/docsify-server-renderer/index.js
Normal file
181
packages/docsify-server-renderer/index.js
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
import * as tpl from '../../src/core/render/tpl'
|
||||
import fetch from 'node-fetch'
|
||||
import {AbstractHistory} from '../../src/core/router/history/abstract'
|
||||
import {Compiler} from '../../src/core/render/compiler'
|
||||
import {isAbsolutePath} from '../../src/core/router/util'
|
||||
import {readFileSync} from 'fs'
|
||||
import {resolve, basename} from 'path'
|
||||
import resolvePathname from 'resolve-pathname'
|
||||
import debug from 'debug'
|
||||
import {prerenderEmbed} from '../../src/core/render/embed'
|
||||
|
||||
function cwd(...args) {
|
||||
return resolve(process.cwd(), ...args)
|
||||
}
|
||||
|
||||
function mainTpl(config) {
|
||||
let html = `<nav class="app-nav${
|
||||
config.repo ? '' : ' no-badge'
|
||||
}"><!--navbar--></nav>`
|
||||
|
||||
if (config.repo) {
|
||||
html += tpl.corner(config.repo)
|
||||
}
|
||||
if (config.coverpage) {
|
||||
html += tpl.cover()
|
||||
}
|
||||
|
||||
html += tpl.main(config)
|
||||
|
||||
return html
|
||||
}
|
||||
|
||||
export default class Renderer {
|
||||
constructor({template, config, cache}) {
|
||||
this.html = template
|
||||
this.config = config = Object.assign({}, config, {
|
||||
routerMode: 'history'
|
||||
})
|
||||
this.cache = cache
|
||||
|
||||
this.router = new AbstractHistory(config)
|
||||
this.compiler = new Compiler(config, this.router)
|
||||
|
||||
this.router.getCurrentPath = () => this.url
|
||||
this._renderHtml(
|
||||
'inject-config',
|
||||
`<script>window.$docsify = ${JSON.stringify(config)}</script>`
|
||||
)
|
||||
this._renderHtml('inject-app', mainTpl(config))
|
||||
|
||||
this.template = this.html
|
||||
}
|
||||
|
||||
_getPath(url) {
|
||||
const file = this.router.getFile(url)
|
||||
|
||||
return isAbsolutePath(file) ? file : cwd(`./${file}`)
|
||||
}
|
||||
|
||||
async renderToString(url) {
|
||||
this.url = url = this.router.parse(url).path
|
||||
const {loadSidebar, loadNavbar, coverpage} = this.config
|
||||
|
||||
const mainFile = this._getPath(url)
|
||||
this._renderHtml('main', await this._render(mainFile, 'main'))
|
||||
|
||||
if (loadSidebar) {
|
||||
const name = loadSidebar === true ? '_sidebar.md' : loadSidebar
|
||||
const sidebarFile = this._getPath(resolve(url, `./${name}`))
|
||||
this._renderHtml('sidebar', await this._render(sidebarFile, 'sidebar'))
|
||||
}
|
||||
|
||||
if (loadNavbar) {
|
||||
const name = loadNavbar === true ? '_navbar.md' : loadNavbar
|
||||
const navbarFile = this._getPath(resolve(url, `./${name}`))
|
||||
this._renderHtml('navbar', await this._render(navbarFile, 'navbar'))
|
||||
}
|
||||
|
||||
if (coverpage) {
|
||||
let path = null
|
||||
if (typeof coverpage === 'string') {
|
||||
if (url === '/') {
|
||||
path = coverpage
|
||||
}
|
||||
} else if (Array.isArray(coverpage)) {
|
||||
path = coverpage.indexOf(url) > -1 && '_coverpage.md'
|
||||
} else {
|
||||
const cover = coverpage[url]
|
||||
path = cover === true ? '_coverpage.md' : cover
|
||||
}
|
||||
|
||||
const coverFile = this._getPath(resolve(url, `./${path}`))
|
||||
|
||||
this._renderHtml('cover', await this._render(coverFile), 'cover')
|
||||
}
|
||||
|
||||
const html = this.html
|
||||
this.html = this.template
|
||||
|
||||
return html
|
||||
}
|
||||
|
||||
_renderHtml(match, content) {
|
||||
this.html = this.html.replace(new RegExp(`<!--${match}-->`, 'g'), content)
|
||||
|
||||
return this.html
|
||||
}
|
||||
|
||||
async _render(path, type) {
|
||||
let html = await this._loadFile(path)
|
||||
const {subMaxLevel, maxLevel} = this.config
|
||||
let tokens
|
||||
|
||||
switch (type) {
|
||||
case 'sidebar':
|
||||
html =
|
||||
this.compiler.sidebar(html, maxLevel) +
|
||||
`<script>window.__SUB_SIDEBAR__ = ${JSON.stringify(
|
||||
this.compiler.subSidebar(subMaxLevel)
|
||||
)}</script>`
|
||||
break
|
||||
case 'cover':
|
||||
html = this.compiler.cover(html)
|
||||
break
|
||||
case 'main':
|
||||
tokens = await new Promise(r => {
|
||||
prerenderEmbed(
|
||||
{
|
||||
fetch: url => this._loadFile(this._getPath(url)),
|
||||
compiler: this.compiler,
|
||||
raw: html
|
||||
},
|
||||
r
|
||||
)
|
||||
})
|
||||
html = this.compiler.compile(tokens)
|
||||
break
|
||||
case 'navbar':
|
||||
case 'article':
|
||||
default:
|
||||
html = this.compiler.compile(html)
|
||||
break
|
||||
}
|
||||
|
||||
return html
|
||||
}
|
||||
|
||||
async _loadFile(filePath) {
|
||||
debug('docsify')(`load > ${filePath}`)
|
||||
let content
|
||||
try {
|
||||
if (isAbsolutePath(filePath)) {
|
||||
const res = await fetch(filePath)
|
||||
if (!res.ok) {
|
||||
throw Error()
|
||||
}
|
||||
content = await res.text()
|
||||
this.lock = 0
|
||||
} else {
|
||||
content = await readFileSync(filePath, 'utf8')
|
||||
this.lock = 0
|
||||
}
|
||||
return content
|
||||
} catch (e) {
|
||||
this.lock = this.lock || 0
|
||||
if (++this.lock > 10) {
|
||||
this.lock = 0
|
||||
return
|
||||
}
|
||||
|
||||
const fileName = basename(filePath)
|
||||
const result = await this._loadFile(
|
||||
resolvePathname(`../${fileName}`, filePath)
|
||||
)
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Renderer.version = '__VERSION__'
|
||||
41
packages/docsify-server-renderer/package-lock.json
generated
Normal file
41
packages/docsify-server-renderer/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.6.8",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
|
||||
"integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw="
|
||||
},
|
||||
"encoding": {
|
||||
"version": "0.1.12",
|
||||
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz",
|
||||
"integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s="
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.18",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz",
|
||||
"integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA=="
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
||||
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "1.7.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz",
|
||||
"integrity": "sha512-j8XsFGCLw79vWXkZtMSmmLaOk9z5SQ9bV/tkbZVCqvgwzrjAGq66igobLofHtF63NvMTp2WjytpsNTGKa+XRIQ=="
|
||||
},
|
||||
"resolve-pathname": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.1.0.tgz",
|
||||
"integrity": "sha1-6DWIAbhrg7F1YNTjw4LXrvIQCUQ="
|
||||
}
|
||||
},
|
||||
"version": "4.9.4"
|
||||
}
|
||||
23
packages/docsify-server-renderer/package.json
Normal file
23
packages/docsify-server-renderer/package.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "docsify-server-renderer",
|
||||
"version": "4.9.4",
|
||||
"description": "docsify server renderer",
|
||||
"author": {
|
||||
"name": "qingwei-li",
|
||||
"email": "cinwell.li@gmail.com",
|
||||
"url": "https://github.com/QingWei-Li"
|
||||
},
|
||||
"homepage": "https://docsify.js.org",
|
||||
"license": "MIT",
|
||||
"repository": "docsifyjs/docsify",
|
||||
"main": "build.js",
|
||||
"scripts": {
|
||||
"test": "echo 'hello'"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^2.6.8",
|
||||
"docsify": "^4.8.0",
|
||||
"node-fetch": "^1.7.0",
|
||||
"resolve-pathname": "^2.1.0"
|
||||
}
|
||||
}
|
||||
55
server.js
Normal file
55
server.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
const liveServer = require('live-server')
|
||||
const isSSR = !!process.env.SSR
|
||||
const middleware = []
|
||||
|
||||
if (isSSR) {
|
||||
const Renderer = require('./packages/docsify-server-renderer/build.js')
|
||||
const renderer = new Renderer({
|
||||
template: `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>docsify</title>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="/themes/vue.css" title="vue">
|
||||
</head>
|
||||
<body>
|
||||
<!--inject-app-->
|
||||
<!--inject-config-->
|
||||
<script src="/lib/docsify.js"></script>
|
||||
</body>
|
||||
</html>`,
|
||||
config: {
|
||||
name: 'docsify',
|
||||
repo: 'docsifyjs/docsify',
|
||||
basePath: 'https://docsify.js.org/',
|
||||
loadNavbar: true,
|
||||
loadSidebar: true,
|
||||
subMaxLevel: 3,
|
||||
auto2top: true,
|
||||
alias: {
|
||||
'/de-de/changelog': '/changelog',
|
||||
'/zh-cn/changelog': '/changelog',
|
||||
'/changelog':
|
||||
'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG'
|
||||
}
|
||||
},
|
||||
path: './'
|
||||
})
|
||||
|
||||
middleware.push(function(req, res, next) {
|
||||
if (/\.(css|js)$/.test(req.url)) {
|
||||
return next()
|
||||
}
|
||||
renderer.renderToString(req.url).then(html => res.end(html))
|
||||
})
|
||||
}
|
||||
|
||||
const params = {
|
||||
port: 3000,
|
||||
watch: ['lib', 'docs', 'themes'],
|
||||
middleware
|
||||
}
|
||||
|
||||
liveServer.start(params)
|
||||
|
|
@ -1,44 +1,71 @@
|
|||
import { merge, hyphenate, isPrimitive } from './util/core'
|
||||
import {merge, hyphenate, isPrimitive, hasOwn} from './util/core'
|
||||
|
||||
const config = merge({
|
||||
el: '#app',
|
||||
repo: '',
|
||||
maxLevel: 6,
|
||||
subMaxLevel: 0,
|
||||
loadSidebar: null,
|
||||
loadNavbar: null,
|
||||
homepage: 'README.md',
|
||||
coverpage: '',
|
||||
basePath: '',
|
||||
auto2top: false,
|
||||
name: '',
|
||||
themeColor: '',
|
||||
nameLink: window.location.pathname,
|
||||
autoHeader: false,
|
||||
executeScript: null,
|
||||
ga: ''
|
||||
}, window.$docsify)
|
||||
export default function () {
|
||||
const config = merge(
|
||||
{
|
||||
el: '#app',
|
||||
repo: '',
|
||||
maxLevel: 6,
|
||||
subMaxLevel: 0,
|
||||
loadSidebar: null,
|
||||
loadNavbar: null,
|
||||
homepage: 'README.md',
|
||||
coverpage: '',
|
||||
basePath: '',
|
||||
auto2top: false,
|
||||
name: '',
|
||||
themeColor: '',
|
||||
nameLink: window.location.pathname,
|
||||
autoHeader: false,
|
||||
executeScript: null,
|
||||
noEmoji: false,
|
||||
ga: '',
|
||||
ext: '.md',
|
||||
mergeNavbar: false,
|
||||
formatUpdated: '',
|
||||
externalLinkTarget: '_blank',
|
||||
routerMode: 'hash',
|
||||
noCompileLinks: [],
|
||||
relativePath: false
|
||||
},
|
||||
window.$docsify
|
||||
)
|
||||
|
||||
const script = document.currentScript ||
|
||||
[].slice.call(document.getElementsByTagName('script'))
|
||||
.filter(n => /docsify\./.test(n.src))[0]
|
||||
const script =
|
||||
document.currentScript ||
|
||||
[].slice
|
||||
.call(document.getElementsByTagName('script'))
|
||||
.filter(n => /docsify\./.test(n.src))[0]
|
||||
|
||||
if (script) {
|
||||
for (const prop in config) {
|
||||
const val = script.getAttribute('data-' + hyphenate(prop))
|
||||
if (script) {
|
||||
for (const prop in config) {
|
||||
if (hasOwn.call(config, prop)) {
|
||||
const val = script.getAttribute('data-' + hyphenate(prop))
|
||||
|
||||
if (isPrimitive(val)) {
|
||||
config[prop] = val === '' ? true : val
|
||||
if (isPrimitive(val)) {
|
||||
config[prop] = val === '' ? true : val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.loadSidebar === true) {
|
||||
config.loadSidebar = '_sidebar' + config.ext
|
||||
}
|
||||
if (config.loadNavbar === true) {
|
||||
config.loadNavbar = '_navbar' + config.ext
|
||||
}
|
||||
if (config.coverpage === true) {
|
||||
config.coverpage = '_coverpage' + config.ext
|
||||
}
|
||||
if (config.repo === true) {
|
||||
config.repo = ''
|
||||
}
|
||||
if (config.name === true) {
|
||||
config.name = ''
|
||||
}
|
||||
}
|
||||
|
||||
if (config.loadSidebar === true) config.loadSidebar = '_sidebar.md'
|
||||
if (config.loadNavbar === true) config.loadNavbar = '_navbar.md'
|
||||
if (config.coverpage === true) config.coverpage = '_coverpage.md'
|
||||
if (config.repo === true) config.repo = ''
|
||||
if (config.name === true) config.name = ''
|
||||
window.$docsify = config
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
window.$docsify = config
|
||||
|
||||
export default config
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
import { isMobile } from '../util/env'
|
||||
import { body, on } from '../util/dom'
|
||||
import {isMobile} from '../util/env'
|
||||
import {body, on} from '../util/dom'
|
||||
import * as sidebar from './sidebar'
|
||||
import { scrollIntoView } from './scroll'
|
||||
import {scrollIntoView} from './scroll'
|
||||
|
||||
export function eventMixin (proto) {
|
||||
export function eventMixin(proto) {
|
||||
proto.$resetEvents = function () {
|
||||
scrollIntoView(this.route.query.id)
|
||||
sidebar.getAndActive('nav')
|
||||
scrollIntoView(this.route.path, this.route.query.id)
|
||||
|
||||
if (this.config.loadNavbar) {
|
||||
sidebar.getAndActive(this.router, 'nav')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function initEvent (vm) {
|
||||
export function initEvent(vm) {
|
||||
// Bind toggle button
|
||||
sidebar.btn('button.sidebar-toggle')
|
||||
sidebar.btn('button.sidebar-toggle', vm.router)
|
||||
sidebar.collapse('.sidebar', vm.router)
|
||||
// Bind sticky effect
|
||||
if (vm.config.coverpage) {
|
||||
!isMobile && on('scroll', sidebar.sticky)
|
||||
|
|
|
|||
|
|
@ -1,90 +1,148 @@
|
|||
import { isMobile } from '../util/env'
|
||||
import {isMobile} from '../util/env'
|
||||
import * as dom from '../util/dom'
|
||||
import { parse } from '../route/hash'
|
||||
import Tweezer from 'tweezer.js'
|
||||
|
||||
const nav = {}
|
||||
let hoverOver = false
|
||||
let scroller = null
|
||||
let enableScrollEvent = true
|
||||
let coverHeight = 0
|
||||
|
||||
function highlight () {
|
||||
function scrollTo(el) {
|
||||
if (scroller) {
|
||||
scroller.stop()
|
||||
}
|
||||
enableScrollEvent = false
|
||||
scroller = new Tweezer({
|
||||
start: window.pageYOffset,
|
||||
end: el.getBoundingClientRect().top + window.pageYOffset,
|
||||
duration: 500
|
||||
})
|
||||
.on('tick', v => window.scrollTo(0, v))
|
||||
.on('done', () => {
|
||||
enableScrollEvent = true
|
||||
scroller = null
|
||||
})
|
||||
.begin()
|
||||
}
|
||||
|
||||
function highlight(path) {
|
||||
if (!enableScrollEvent) {
|
||||
return
|
||||
}
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
const anchors = dom.findAll('.anchor')
|
||||
const wrap = dom.find(sidebar, '.sidebar-nav')
|
||||
let active = dom.find(sidebar, 'li.active')
|
||||
const top = dom.body.scrollTop
|
||||
const doc = document.documentElement
|
||||
const top = ((doc && doc.scrollTop) || document.body.scrollTop) - coverHeight
|
||||
let last
|
||||
|
||||
for (let i = 0, len = anchors.length; i < len; i += 1) {
|
||||
const node = anchors[i]
|
||||
|
||||
if (node.offsetTop > top) {
|
||||
if (!last) last = node
|
||||
if (!last) {
|
||||
last = node
|
||||
}
|
||||
break
|
||||
} else {
|
||||
last = node
|
||||
}
|
||||
}
|
||||
if (!last) return
|
||||
const li = nav[last.getAttribute('data-id')]
|
||||
if (!last) {
|
||||
return
|
||||
}
|
||||
const li = nav[getNavKey(decodeURIComponent(path), last.getAttribute('data-id'))]
|
||||
|
||||
if (!li || li === active) return
|
||||
if (!li || li === active) {
|
||||
return
|
||||
}
|
||||
|
||||
active && active.classList.remove('active')
|
||||
li.classList.add('active')
|
||||
active = li
|
||||
|
||||
// scroll into view
|
||||
// Scroll into view
|
||||
// https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js#L282-L297
|
||||
if (!hoverOver && dom.body.classList.contains('sticky')) {
|
||||
const height = sidebar.clientHeight
|
||||
const curOffset = 0
|
||||
const cur = active.offsetTop + active.clientHeight + 40
|
||||
const isInView = (
|
||||
active.offsetTop >= wrap.scrollTop &&
|
||||
cur <= wrap.scrollTop + height
|
||||
)
|
||||
const isInView =
|
||||
active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height
|
||||
const notThan = cur - curOffset < height
|
||||
const top = isInView
|
||||
? wrap.scrollTop
|
||||
: notThan
|
||||
? curOffset
|
||||
: cur - height
|
||||
const top = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height
|
||||
|
||||
sidebar.scrollTop = top
|
||||
}
|
||||
}
|
||||
|
||||
export function scrollActiveSidebar () {
|
||||
if (isMobile) return
|
||||
function getNavKey(path, id) {
|
||||
return `${path}?id=${id}`
|
||||
}
|
||||
|
||||
export function scrollActiveSidebar(router) {
|
||||
const cover = dom.find('.cover.show')
|
||||
coverHeight = cover ? cover.offsetHeight : 0
|
||||
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
const lis = dom.findAll(sidebar, 'li')
|
||||
let lis = []
|
||||
if (sidebar != null) {
|
||||
lis = dom.findAll(sidebar, 'li')
|
||||
}
|
||||
|
||||
for (let i = 0, len = lis.length; i < len; i += 1) {
|
||||
const li = lis[i]
|
||||
const a = li.querySelector('a')
|
||||
if (!a) continue
|
||||
if (!a) {
|
||||
continue
|
||||
}
|
||||
let href = a.getAttribute('href')
|
||||
|
||||
if (href !== '/') {
|
||||
href = parse(href).query.id
|
||||
const {query: {id}, path} = router.parse(href)
|
||||
if (id) {
|
||||
href = getNavKey(path, id)
|
||||
}
|
||||
}
|
||||
|
||||
nav[decodeURIComponent(href)] = li
|
||||
if (href) {
|
||||
nav[decodeURIComponent(href)] = li
|
||||
}
|
||||
}
|
||||
|
||||
dom.off('scroll', highlight)
|
||||
dom.on('scroll', highlight)
|
||||
dom.on(sidebar, 'mouseover', () => { hoverOver = true })
|
||||
dom.on(sidebar, 'mouseleave', () => { hoverOver = false })
|
||||
if (isMobile) {
|
||||
return
|
||||
}
|
||||
const path = router.getCurrentPath()
|
||||
dom.off('scroll', () => highlight(path))
|
||||
dom.on('scroll', () => highlight(path))
|
||||
dom.on(sidebar, 'mouseover', () => {
|
||||
hoverOver = true
|
||||
})
|
||||
dom.on(sidebar, 'mouseleave', () => {
|
||||
hoverOver = false
|
||||
})
|
||||
}
|
||||
|
||||
export function scrollIntoView (id) {
|
||||
export function scrollIntoView(path, id) {
|
||||
if (!id) {
|
||||
return
|
||||
}
|
||||
|
||||
const section = dom.find('#' + id)
|
||||
section && section.scrollIntoView()
|
||||
section && scrollTo(section)
|
||||
|
||||
const li = nav[getNavKey(path, id)]
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
const active = dom.find(sidebar, 'li.active')
|
||||
active && active.classList.remove('active')
|
||||
li && li.classList.add('active')
|
||||
}
|
||||
|
||||
const scrollEl = dom.$.scrollingElement || dom.$.documentElement
|
||||
|
||||
export function scroll2Top (offset = 0) {
|
||||
export function scroll2Top(offset = 0) {
|
||||
scrollEl.scrollTop = offset === true ? 0 : Number(offset)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,51 @@
|
|||
import { isMobile } from '../util/env'
|
||||
import {isMobile} from '../util/env'
|
||||
import * as dom from '../util/dom'
|
||||
import { getHash } from '../route/hash'
|
||||
|
||||
const title = dom.$.title
|
||||
/**
|
||||
* Toggle button
|
||||
*/
|
||||
export function btn (el) {
|
||||
const toggle = () => dom.body.classList.toggle('close')
|
||||
export function btn(el) {
|
||||
const toggle = _ => dom.body.classList.toggle('close')
|
||||
|
||||
el = dom.getNode(el)
|
||||
dom.on(el, 'click', toggle)
|
||||
|
||||
if (isMobile) {
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
|
||||
dom.on(sidebar, 'click', () => {
|
||||
toggle()
|
||||
setTimeout(() => getAndActive(sidebar, true, true), 0)
|
||||
})
|
||||
if (el == null) {
|
||||
return
|
||||
}
|
||||
dom.on(el, 'click', e => {
|
||||
e.stopPropagation()
|
||||
toggle()
|
||||
})
|
||||
|
||||
isMobile &&
|
||||
dom.on(
|
||||
dom.body,
|
||||
'click',
|
||||
_ => dom.body.classList.contains('close') && toggle()
|
||||
)
|
||||
}
|
||||
|
||||
export function sticky () {
|
||||
export function collapse(el) {
|
||||
el = dom.getNode(el)
|
||||
if (el == null) {
|
||||
return
|
||||
}
|
||||
dom.on(el, 'click', ({target}) => {
|
||||
if (
|
||||
target.nodeName === 'A' &&
|
||||
target.nextSibling &&
|
||||
target.nextSibling.classList.contains('app-sub-sidebar')
|
||||
) {
|
||||
dom.toggleClass(target.parentNode, 'collapse')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function sticky() {
|
||||
const cover = dom.getNode('section.cover')
|
||||
if (!cover) return
|
||||
if (!cover) {
|
||||
return
|
||||
}
|
||||
const coverHeight = cover.getBoundingClientRect().height
|
||||
|
||||
if (window.pageYOffset >= coverHeight || cover.classList.contains('hidden')) {
|
||||
|
|
@ -36,34 +57,35 @@ export function sticky () {
|
|||
|
||||
/**
|
||||
* Get and active link
|
||||
* @param {object} router
|
||||
* @param {string|element} el
|
||||
* @param {Boolean} isParent acitve parent
|
||||
* @param {Boolean} autoTitle auto set title
|
||||
* @return {element}
|
||||
*/
|
||||
export function getAndActive (el, isParent, autoTitle) {
|
||||
export function getAndActive(router, el, isParent, autoTitle) {
|
||||
el = dom.getNode(el)
|
||||
|
||||
const links = dom.findAll(el, 'a')
|
||||
const hash = '#' + getHash()
|
||||
let links = []
|
||||
if (el != null) {
|
||||
links = dom.findAll(el, 'a')
|
||||
}
|
||||
const hash = decodeURI(router.toURL(router.getCurrentPath()))
|
||||
let target
|
||||
|
||||
links
|
||||
.sort((a, b) => b.href.length - a.href.length)
|
||||
.forEach(a => {
|
||||
const href = a.getAttribute('href')
|
||||
const node = isParent ? a.parentNode : a
|
||||
links.sort((a, b) => b.href.length - a.href.length).forEach(a => {
|
||||
const href = a.getAttribute('href')
|
||||
const node = isParent ? a.parentNode : a
|
||||
|
||||
if (hash.indexOf(href) === 0 && !target) {
|
||||
target = a
|
||||
dom.toggleClass(node, 'add', 'active')
|
||||
} else {
|
||||
dom.toggleClass(node, 'remove', 'active')
|
||||
}
|
||||
})
|
||||
if (hash.indexOf(href) === 0 && !target) {
|
||||
target = a
|
||||
dom.toggleClass(node, 'add', 'active')
|
||||
} else {
|
||||
dom.toggleClass(node, 'remove', 'active')
|
||||
}
|
||||
})
|
||||
|
||||
if (autoTitle) {
|
||||
dom.$.title = target ? `${target.innerText} - ${title}` : title
|
||||
dom.$.title = target ? (target.title || `${target.innerText} - ${title}`) : title
|
||||
}
|
||||
|
||||
return target
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import progressbar from '../render/progressbar'
|
||||
import { noop } from '../util/core'
|
||||
import {noop, hasOwn} from '../util/core'
|
||||
|
||||
const cache = {}
|
||||
const RUN_VERSION = Date.now()
|
||||
|
||||
/**
|
||||
* Simple ajax get
|
||||
|
|
@ -10,27 +9,35 @@ const RUN_VERSION = Date.now()
|
|||
* @param {boolean} [hasBar=false] has progress bar
|
||||
* @return { then(resolve, reject), abort }
|
||||
*/
|
||||
export function get (url, hasBar = false) {
|
||||
export function get(url, hasBar = false, headers = {}) {
|
||||
const xhr = new XMLHttpRequest()
|
||||
const on = function () {
|
||||
xhr.addEventListener.apply(xhr, arguments)
|
||||
}
|
||||
const cached = cache[url]
|
||||
|
||||
url += (/\?(\w+)=/g.test(url) ? '&' : '?') + `v=${RUN_VERSION}`
|
||||
|
||||
if (cache[url]) {
|
||||
return { then: cb => cb(cache[url]), abort: noop }
|
||||
if (cached) {
|
||||
return {then: cb => cb(cached.content, cached.opt), abort: noop}
|
||||
}
|
||||
|
||||
xhr.open('GET', url)
|
||||
for (const i in headers) {
|
||||
if (hasOwn.call(headers, i)) {
|
||||
xhr.setRequestHeader(i, headers[i])
|
||||
}
|
||||
}
|
||||
xhr.send()
|
||||
|
||||
return {
|
||||
then: function (success, error = noop) {
|
||||
if (hasBar) {
|
||||
const id = setInterval(_ => progressbar({
|
||||
step: Math.floor(Math.random() * 5 + 1)
|
||||
}), 500)
|
||||
const id = setInterval(
|
||||
_ =>
|
||||
progressbar({
|
||||
step: Math.floor(Math.random() * 5 + 1)
|
||||
}),
|
||||
500
|
||||
)
|
||||
|
||||
on('progress', progressbar)
|
||||
on('loadend', evt => {
|
||||
|
|
@ -40,12 +47,18 @@ export function get (url, hasBar = false) {
|
|||
}
|
||||
|
||||
on('error', error)
|
||||
on('load', ({ target }) => {
|
||||
on('load', ({target}) => {
|
||||
if (target.status >= 400) {
|
||||
error(target)
|
||||
} else {
|
||||
cache[url] = target.response
|
||||
success(target.response)
|
||||
const result = (cache[url] = {
|
||||
content: target.response,
|
||||
opt: {
|
||||
updatedAt: xhr.getResponseHeader('last-modified')
|
||||
}
|
||||
})
|
||||
|
||||
success(result.content, result.opt)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,72 +1,235 @@
|
|||
import { get } from './ajax'
|
||||
import { callHook } from '../init/lifecycle'
|
||||
import { getRoot } from '../route/util'
|
||||
import { noop } from '../util/core'
|
||||
import {get} from './ajax'
|
||||
import {callHook} from '../init/lifecycle'
|
||||
import {getParentPath, stringifyQuery} from '../router/util'
|
||||
import {noop} from '../util/core'
|
||||
import {getAndActive} from '../event/sidebar'
|
||||
|
||||
export function fetchMixin (proto) {
|
||||
function loadNested(path, qs, file, next, vm, first) {
|
||||
path = first ? path : path.replace(/\/$/, '')
|
||||
path = getParentPath(path)
|
||||
|
||||
if (!path) {
|
||||
return
|
||||
}
|
||||
|
||||
get(
|
||||
vm.router.getFile(path + file) + qs,
|
||||
false,
|
||||
vm.config.requestHeaders
|
||||
).then(next, _ => loadNested(path, qs, file, next, vm))
|
||||
}
|
||||
|
||||
export function fetchMixin(proto) {
|
||||
let last
|
||||
proto._fetch = function (cb = noop) {
|
||||
const { path } = this.route
|
||||
const { loadNavbar, loadSidebar } = this.config
|
||||
const root = getRoot(path)
|
||||
|
||||
// Abort last request
|
||||
last && last.abort && last.abort()
|
||||
const abort = () => last && last.abort && last.abort()
|
||||
const request = (url, hasbar, requestHeaders) => {
|
||||
abort()
|
||||
last = get(url, true, requestHeaders)
|
||||
return last
|
||||
}
|
||||
|
||||
last = get(this.$getFile(path), true)
|
||||
const get404Path = (path, config) => {
|
||||
const {notFoundPage, ext} = config
|
||||
const defaultPath = '_404' + (ext || '.md')
|
||||
let key
|
||||
let path404
|
||||
|
||||
// Current page is html
|
||||
this.isHTML = /\.html$/g.test(path)
|
||||
switch (typeof notFoundPage) {
|
||||
case 'boolean':
|
||||
path404 = defaultPath
|
||||
break
|
||||
case 'string':
|
||||
path404 = notFoundPage
|
||||
break
|
||||
|
||||
// Load main content
|
||||
last.then(text => {
|
||||
this._renderMain(text)
|
||||
if (!loadSidebar) return cb()
|
||||
case 'object':
|
||||
key = Object.keys(notFoundPage)
|
||||
.sort((a, b) => b.length - a.length)
|
||||
.find(key => path.match(new RegExp('^' + key)))
|
||||
|
||||
const fn = result => { this._renderSidebar(result); cb() }
|
||||
path404 = (key && notFoundPage[key]) || defaultPath
|
||||
break
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
return path404
|
||||
}
|
||||
|
||||
proto._loadSideAndNav = function (path, qs, loadSidebar, cb) {
|
||||
return () => {
|
||||
if (!loadSidebar) {
|
||||
return cb()
|
||||
}
|
||||
|
||||
const fn = result => {
|
||||
this._renderSidebar(result)
|
||||
cb()
|
||||
}
|
||||
|
||||
// Load sidebar
|
||||
get(this.$getFile(root + loadSidebar))
|
||||
// fallback root navbar when fail
|
||||
.then(fn, _ => get(loadSidebar).then(fn))
|
||||
},
|
||||
_ => this._renderMain(null))
|
||||
loadNested(path, qs, loadSidebar, fn, this, true)
|
||||
}
|
||||
}
|
||||
|
||||
proto._fetch = function (cb = noop) {
|
||||
const {path, query} = this.route
|
||||
const qs = stringifyQuery(query, ['id'])
|
||||
const {loadNavbar, requestHeaders, loadSidebar} = this.config
|
||||
// Abort last request
|
||||
|
||||
const file = this.router.getFile(path)
|
||||
const req = request(file + qs, true, requestHeaders)
|
||||
|
||||
// Current page is html
|
||||
this.isHTML = /\.html$/g.test(file)
|
||||
|
||||
// Load main content
|
||||
req.then(
|
||||
(text, opt) =>
|
||||
this._renderMain(
|
||||
text,
|
||||
opt,
|
||||
this._loadSideAndNav(path, qs, loadSidebar, cb)
|
||||
),
|
||||
_ => {
|
||||
this._fetchFallbackPage(file, qs, cb) || this._fetch404(file, qs, cb)
|
||||
}
|
||||
)
|
||||
|
||||
// Load nav
|
||||
loadNavbar &&
|
||||
get(this.$getFile(root + loadNavbar))
|
||||
.then(
|
||||
loadNested(
|
||||
path,
|
||||
qs,
|
||||
loadNavbar,
|
||||
text => this._renderNav(text),
|
||||
// fallback root navbar when fail
|
||||
_ => get(loadNavbar).then(text => this._renderNav(text))
|
||||
this,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
proto._fetchCover = function () {
|
||||
const { coverpage } = this.config
|
||||
const root = getRoot(this.route.path)
|
||||
const path = this.$getFile(root + coverpage)
|
||||
const {coverpage, requestHeaders} = this.config
|
||||
const query = this.route.query
|
||||
const root = getParentPath(this.route.path)
|
||||
|
||||
if (this.route.path !== '/' || !coverpage) {
|
||||
this._renderCover()
|
||||
return
|
||||
if (coverpage) {
|
||||
let path = null
|
||||
const routePath = this.route.path
|
||||
if (typeof coverpage === 'string') {
|
||||
if (routePath === '/') {
|
||||
path = coverpage
|
||||
}
|
||||
} else if (Array.isArray(coverpage)) {
|
||||
path = coverpage.indexOf(routePath) > -1 && '_coverpage'
|
||||
} else {
|
||||
const cover = coverpage[routePath]
|
||||
path = cover === true ? '_coverpage' : cover
|
||||
}
|
||||
|
||||
const coverOnly = Boolean(path) && this.config.onlyCover
|
||||
if (path) {
|
||||
path = this.router.getFile(root + path)
|
||||
this.coverIsHTML = /\.html$/g.test(path)
|
||||
get(path + stringifyQuery(query, ['id']), false, requestHeaders).then(
|
||||
text => this._renderCover(text, coverOnly)
|
||||
)
|
||||
} else {
|
||||
this._renderCover(null, coverOnly)
|
||||
}
|
||||
return coverOnly
|
||||
}
|
||||
|
||||
this.coverIsHTML = /\.html$/g.test(path)
|
||||
get(path)
|
||||
.then(text => this._renderCover(text))
|
||||
}
|
||||
|
||||
proto.$fetch = function (cb = noop) {
|
||||
this._fetchCover()
|
||||
this._fetch(result => {
|
||||
this.$resetEvents()
|
||||
const done = () => {
|
||||
callHook(this, 'doneEach')
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
||||
const onlyCover = this._fetchCover()
|
||||
|
||||
if (onlyCover) {
|
||||
done()
|
||||
} else {
|
||||
this._fetch(() => {
|
||||
this.$resetEvents()
|
||||
done()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
proto._fetchFallbackPage = function (path, qs, cb = noop) {
|
||||
const {requestHeaders, fallbackLanguages, loadSidebar} = this.config
|
||||
|
||||
if (!fallbackLanguages) {
|
||||
return false
|
||||
}
|
||||
|
||||
const local = path.split('/')[1]
|
||||
|
||||
if (fallbackLanguages.indexOf(local) === -1) {
|
||||
return false
|
||||
}
|
||||
const newPath = path.replace(new RegExp(`^/${local}`), '')
|
||||
const req = request(newPath + qs, true, requestHeaders)
|
||||
|
||||
req.then(
|
||||
(text, opt) =>
|
||||
this._renderMain(
|
||||
text,
|
||||
opt,
|
||||
this._loadSideAndNav(path, qs, loadSidebar, cb)
|
||||
),
|
||||
() => this._fetch404(path, qs, cb)
|
||||
)
|
||||
|
||||
return true
|
||||
}
|
||||
/**
|
||||
* Load the 404 page
|
||||
* @param path
|
||||
* @param qs
|
||||
* @param cb
|
||||
* @returns {*}
|
||||
* @private
|
||||
*/
|
||||
proto._fetch404 = function (path, qs, cb = noop) {
|
||||
const {loadSidebar, requestHeaders, notFoundPage} = this.config
|
||||
|
||||
const fnLoadSideAndNav = this._loadSideAndNav(path, qs, loadSidebar, cb)
|
||||
if (notFoundPage) {
|
||||
const path404 = get404Path(path, this.config)
|
||||
|
||||
request(this.router.getFile(path404), true, requestHeaders).then(
|
||||
(text, opt) => this._renderMain(text, opt, fnLoadSideAndNav),
|
||||
() => this._renderMain(null, {}, fnLoadSideAndNav)
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
this._renderMain(null, {}, fnLoadSideAndNav)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export function initFetch (vm) {
|
||||
vm.$fetch(_ => callHook(vm, 'ready'))
|
||||
export function initFetch(vm) {
|
||||
const {loadSidebar} = vm.config
|
||||
|
||||
// Server-Side Rendering
|
||||
if (vm.rendered) {
|
||||
const activeEl = getAndActive(vm.router, '.sidebar-nav', true, true)
|
||||
if (loadSidebar && activeEl) {
|
||||
activeEl.parentNode.innerHTML += window.__SUB_SIDEBAR__
|
||||
}
|
||||
vm._bindEventOnRendered(activeEl)
|
||||
vm.$resetEvents()
|
||||
callHook(vm, 'doneEach')
|
||||
callHook(vm, 'ready')
|
||||
} else {
|
||||
vm.$fetch(_ => callHook(vm, 'ready'))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,20 @@
|
|||
import * as util from './util'
|
||||
import * as dom from './util/dom'
|
||||
import * as render from './render/compiler'
|
||||
import * as route from './route/hash'
|
||||
import { get } from './fetch/ajax'
|
||||
import {Compiler} from './render/compiler'
|
||||
import {slugify} from './render/slugify'
|
||||
import {get} from './fetch/ajax'
|
||||
import marked from 'marked'
|
||||
import prism from 'prismjs'
|
||||
|
||||
export default function () {
|
||||
window.Docsify = { util, dom, render, route, get }
|
||||
window.Docsify = {
|
||||
util,
|
||||
dom,
|
||||
get,
|
||||
slugify,
|
||||
version: '__VERSION__'
|
||||
}
|
||||
window.DocsifyCompiler = Compiler
|
||||
window.marked = marked
|
||||
window.Prism = prism
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,31 @@
|
|||
import { initMixin } from './init'
|
||||
import { routeMixin } from './route'
|
||||
import { renderMixin } from './render'
|
||||
import { fetchMixin } from './fetch'
|
||||
import { eventMixin } from './event'
|
||||
import {initMixin} from './init'
|
||||
import {routerMixin} from './router'
|
||||
import {renderMixin} from './render'
|
||||
import {fetchMixin} from './fetch'
|
||||
import {eventMixin} from './event'
|
||||
import initGlobalAPI from './global-api'
|
||||
|
||||
function Docsify () {
|
||||
/**
|
||||
* Fork https://github.com/bendrucker/document-ready/blob/master/index.js
|
||||
*/
|
||||
function ready(callback) {
|
||||
const state = document.readyState
|
||||
|
||||
if (state === 'complete' || state === 'interactive') {
|
||||
return setTimeout(callback, 0)
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', callback)
|
||||
}
|
||||
|
||||
function Docsify() {
|
||||
this._init()
|
||||
}
|
||||
|
||||
const proto = Docsify.prototype
|
||||
|
||||
initMixin(proto)
|
||||
routeMixin(proto)
|
||||
routerMixin(proto)
|
||||
renderMixin(proto)
|
||||
fetchMixin(proto)
|
||||
eventMixin(proto)
|
||||
|
|
@ -25,4 +38,4 @@ initGlobalAPI()
|
|||
/**
|
||||
* Run Docsify
|
||||
*/
|
||||
setTimeout(_ => new Docsify(), 0)
|
||||
ready(_ => new Docsify())
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
import config from '../config'
|
||||
import { initLifecycle, callHook } from './lifecycle'
|
||||
import { initRender } from '../render'
|
||||
import { initRoute } from '../route'
|
||||
import { initEvent } from '../event'
|
||||
import { initFetch } from '../fetch'
|
||||
import { isFn } from '../util/core'
|
||||
import {initLifecycle, callHook} from './lifecycle'
|
||||
import {initRender} from '../render'
|
||||
import {initRouter} from '../router'
|
||||
import {initEvent} from '../event'
|
||||
import {initFetch} from '../fetch'
|
||||
import {isFn} from '../util/core'
|
||||
|
||||
export function initMixin (proto) {
|
||||
export function initMixin(proto) {
|
||||
proto._init = function () {
|
||||
const vm = this
|
||||
vm.config = config || {}
|
||||
vm.config = config()
|
||||
|
||||
initLifecycle(vm) // Init hooks
|
||||
initPlugin(vm) // Install plugins
|
||||
callHook(vm, 'init')
|
||||
initRouter(vm) // Add router
|
||||
initRender(vm) // Render base DOM
|
||||
initEvent(vm) // Bind events
|
||||
initRoute(vm) // Add hashchange eventListener
|
||||
initFetch(vm) // Fetch data
|
||||
callHook(vm, 'mounted')
|
||||
}
|
||||
}
|
||||
|
||||
function initPlugin (vm) {
|
||||
function initPlugin(vm) {
|
||||
[].concat(vm.config.plugins).forEach(fn => isFn(fn) && fn(vm._lifecycle, vm))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { noop } from '../util/core'
|
||||
import {noop} from '../util/core'
|
||||
|
||||
export function initLifecycle (vm) {
|
||||
export function initLifecycle(vm) {
|
||||
const hooks = [
|
||||
'init',
|
||||
'mounted',
|
||||
|
|
@ -13,34 +13,31 @@ export function initLifecycle (vm) {
|
|||
vm._hooks = {}
|
||||
vm._lifecycle = {}
|
||||
hooks.forEach(hook => {
|
||||
const arr = vm._hooks[hook] = []
|
||||
const arr = (vm._hooks[hook] = [])
|
||||
vm._lifecycle[hook] = fn => arr.push(fn)
|
||||
})
|
||||
}
|
||||
|
||||
export function callHook (vm, hook, data, next = noop) {
|
||||
let newData = data
|
||||
export function callHook(vm, hook, data, next = noop) {
|
||||
const queue = vm._hooks[hook]
|
||||
|
||||
const step = function (index) {
|
||||
const hook = queue[index]
|
||||
if (index >= queue.length) {
|
||||
next(newData)
|
||||
} else {
|
||||
if (typeof hook === 'function') {
|
||||
if (hook.length === 2) {
|
||||
hook(data, result => {
|
||||
newData = result
|
||||
step(index + 1)
|
||||
})
|
||||
} else {
|
||||
const result = hook(data)
|
||||
newData = result !== undefined ? result : newData
|
||||
next(data)
|
||||
} else if (typeof hook === 'function') {
|
||||
if (hook.length === 2) {
|
||||
hook(data, result => {
|
||||
data = result
|
||||
step(index + 1)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const result = hook(data)
|
||||
data = result === undefined ? data : result
|
||||
step(index + 1)
|
||||
}
|
||||
} else {
|
||||
step(index + 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,142 +1,397 @@
|
|||
import marked from 'marked'
|
||||
import Prism from 'prismjs'
|
||||
import { helper as helperTpl, tree as treeTpl } from './tpl'
|
||||
import { genTree } from './gen-tree'
|
||||
import { slugify, clearSlugCache } from './slugify'
|
||||
import { emojify } from './emojify'
|
||||
import { toURL, parse } from '../route/hash'
|
||||
import { getBasePath, isAbsolutePath, getPath } from '../route/util'
|
||||
import { isFn, merge, cached } from '../util/core'
|
||||
import {helper as helperTpl, tree as treeTpl} from './tpl'
|
||||
import {genTree} from './gen-tree'
|
||||
import {slugify} from './slugify'
|
||||
import {emojify} from './emojify'
|
||||
import {isAbsolutePath, getPath, getParentPath} from '../router/util'
|
||||
import {isFn, merge, cached, isPrimitive} from '../util/core'
|
||||
|
||||
let markdownCompiler = marked
|
||||
let contentBase = ''
|
||||
let currentPath = ''
|
||||
let renderer = new marked.Renderer()
|
||||
const TOC = {}
|
||||
let toc = []
|
||||
// See https://github.com/PrismJS/prism/pull/1367
|
||||
import 'prismjs/components/prism-markup-templating'
|
||||
|
||||
/**
|
||||
* Compile markdown content
|
||||
*/
|
||||
export const markdown = cached(text => {
|
||||
let html = ''
|
||||
const cachedLinks = {}
|
||||
|
||||
if (!text) return text
|
||||
export function getAndRemoveConfig(str = '') {
|
||||
const config = {}
|
||||
|
||||
html = markdownCompiler(text)
|
||||
html = emojify(html)
|
||||
clearSlugCache()
|
||||
if (str) {
|
||||
str = str
|
||||
.replace(/^'/, '')
|
||||
.replace(/'$/, '')
|
||||
.replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
|
||||
config[key] = (value && value.replace(/"/g, '')) || true
|
||||
return ''
|
||||
})
|
||||
.trim()
|
||||
}
|
||||
|
||||
return html
|
||||
})
|
||||
return {str, config}
|
||||
}
|
||||
|
||||
markdown.renderer = renderer
|
||||
const compileMedia = {
|
||||
markdown(url) {
|
||||
return {
|
||||
url
|
||||
}
|
||||
},
|
||||
mermaid(url) {
|
||||
return {
|
||||
url
|
||||
}
|
||||
},
|
||||
iframe(url, title) {
|
||||
return {
|
||||
html: `<iframe src="${url}" ${title || 'width=100% height=400'}></iframe>`
|
||||
}
|
||||
},
|
||||
video(url, title) {
|
||||
return {
|
||||
html: `<video src="${url}" ${title || 'controls'}>Not Support</video>`
|
||||
}
|
||||
},
|
||||
audio(url, title) {
|
||||
return {
|
||||
html: `<audio src="${url}" ${title || 'controls'}>Not Support</audio>`
|
||||
}
|
||||
},
|
||||
code(url, title) {
|
||||
let lang = url.match(/\.(\w+)$/)
|
||||
|
||||
markdown.init = function (config = {}, base = window.location.pathname) {
|
||||
contentBase = getBasePath(base)
|
||||
currentPath = parse().path
|
||||
lang = title || (lang && lang[1])
|
||||
if (lang === 'md') {
|
||||
lang = 'markdown'
|
||||
}
|
||||
|
||||
if (isFn(config)) {
|
||||
markdownCompiler = config(marked, renderer)
|
||||
} else {
|
||||
renderer = merge(renderer, config.renderer)
|
||||
marked.setOptions(merge(config, { renderer }))
|
||||
return {
|
||||
url,
|
||||
lang
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
markdown.update = function () {
|
||||
currentPath = parse().path
|
||||
}
|
||||
export class Compiler {
|
||||
constructor(config, router) {
|
||||
this.config = config
|
||||
this.router = router
|
||||
this.cacheTree = {}
|
||||
this.toc = []
|
||||
this.cacheTOC = {}
|
||||
this.linkTarget = config.externalLinkTarget || '_blank'
|
||||
this.contentBase = router.getBasePath()
|
||||
|
||||
/**
|
||||
* render anchor tag
|
||||
* @link https://github.com/chjj/marked#overriding-renderer-methods
|
||||
*/
|
||||
renderer.heading = function (text, level) {
|
||||
const slug = slugify(text)
|
||||
const url = toURL(currentPath, { id: slug })
|
||||
const renderer = this._initRenderer()
|
||||
let compile
|
||||
const mdConf = config.markdown || {}
|
||||
|
||||
toc.push({ level, slug: url, title: text })
|
||||
if (isFn(mdConf)) {
|
||||
compile = mdConf(marked, renderer)
|
||||
} else {
|
||||
marked.setOptions(
|
||||
merge(mdConf, {
|
||||
renderer: merge(renderer, mdConf.renderer)
|
||||
})
|
||||
)
|
||||
compile = marked
|
||||
}
|
||||
|
||||
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
|
||||
}
|
||||
// highlight code
|
||||
renderer.code = function (code, lang = '') {
|
||||
const hl = Prism.highlight(code, Prism.languages[lang] || Prism.languages.markup)
|
||||
this._marked = compile
|
||||
this.compile = text => {
|
||||
let isCached = true
|
||||
const result = cached(_ => {
|
||||
isCached = false
|
||||
let html = ''
|
||||
|
||||
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
|
||||
}
|
||||
renderer.link = function (href, title, text) {
|
||||
let blank = ''
|
||||
if (!/:|(\/{2})/.test(href)) {
|
||||
href = toURL(href)
|
||||
} else {
|
||||
blank = ' target="_blank"'
|
||||
}
|
||||
if (title) {
|
||||
title = ` title="${title}"`
|
||||
}
|
||||
return `<a href="${href}"${title}${blank}>${text}</a>`
|
||||
}
|
||||
renderer.paragraph = function (text) {
|
||||
if (/^!>/.test(text)) {
|
||||
return helperTpl('tip', text)
|
||||
} else if (/^\?>/.test(text)) {
|
||||
return helperTpl('warn', text)
|
||||
}
|
||||
return `<p>${text}</p>`
|
||||
}
|
||||
renderer.image = function (href, title, text) {
|
||||
let url = href
|
||||
const titleHTML = title ? ` title="${title}"` : ''
|
||||
if (!text) {
|
||||
return text
|
||||
}
|
||||
|
||||
if (!isAbsolutePath(href)) {
|
||||
url = getPath(contentBase, href)
|
||||
if (isPrimitive(text)) {
|
||||
html = compile(text)
|
||||
} else {
|
||||
html = compile.parser(text)
|
||||
}
|
||||
|
||||
html = config.noEmoji ? html : emojify(html)
|
||||
slugify.clear()
|
||||
|
||||
return html
|
||||
})(text)
|
||||
|
||||
const curFileName = this.router.parse().file
|
||||
|
||||
if (isCached) {
|
||||
this.toc = this.cacheTOC[curFileName]
|
||||
} else {
|
||||
this.cacheTOC[curFileName] = [...this.toc]
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
return `<img src="${url}" data-origin="${href}" alt="${text}"${titleHTML}>`
|
||||
}
|
||||
compileEmbed(href, title) {
|
||||
const {str, config} = getAndRemoveConfig(title)
|
||||
let embed
|
||||
title = str
|
||||
|
||||
/**
|
||||
* Compile sidebar
|
||||
*/
|
||||
export function sidebar (text, level) {
|
||||
let html = ''
|
||||
if (config.include) {
|
||||
if (!isAbsolutePath(href)) {
|
||||
href = getPath(
|
||||
process.env.SSR ? '' : this.contentBase,
|
||||
getParentPath(this.router.getCurrentPath()),
|
||||
href
|
||||
)
|
||||
}
|
||||
|
||||
if (text) {
|
||||
html = markdown(text)
|
||||
html = html.match(/<ul[^>]*>([\s\S]+)<\/ul>/g)[0]
|
||||
} else {
|
||||
const tree = genTree(toc, level)
|
||||
html = treeTpl(tree, '<ul>')
|
||||
let media
|
||||
if (config.type && (media = compileMedia[config.type])) {
|
||||
embed = media.call(this, href, title)
|
||||
embed.type = config.type
|
||||
} else {
|
||||
let type = 'code'
|
||||
if (/\.(md|markdown)/.test(href)) {
|
||||
type = 'markdown'
|
||||
} else if (/\.mmd/.test(href)) {
|
||||
type = 'mermaid'
|
||||
} else if (/\.html?/.test(href)) {
|
||||
type = 'iframe'
|
||||
} else if (/\.(mp4|ogg)/.test(href)) {
|
||||
type = 'video'
|
||||
} else if (/\.mp3/.test(href)) {
|
||||
type = 'audio'
|
||||
}
|
||||
embed = compileMedia[type].call(this, href, title)
|
||||
embed.type = type
|
||||
}
|
||||
embed.fragment = config.fragment
|
||||
|
||||
return embed
|
||||
}
|
||||
}
|
||||
|
||||
return html
|
||||
}
|
||||
_matchNotCompileLink(link) {
|
||||
const links = this.config.noCompileLinks || []
|
||||
|
||||
/**
|
||||
* Compile sub sidebar
|
||||
*/
|
||||
export function subSidebar (el, level) {
|
||||
if (el) {
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
const n = links[i]
|
||||
const re = cachedLinks[n] || (cachedLinks[n] = new RegExp(`^${n}$`))
|
||||
|
||||
if (re.test(link)) {
|
||||
return link
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_initRenderer() {
|
||||
const renderer = new marked.Renderer()
|
||||
const {linkTarget, router, contentBase} = this
|
||||
const _self = this
|
||||
const origin = {}
|
||||
|
||||
/**
|
||||
* Render anchor tag
|
||||
* @link https://github.com/markedjs/marked#overriding-renderer-methods
|
||||
*/
|
||||
origin.heading = renderer.heading = function (text, level) {
|
||||
let {str, config} = getAndRemoveConfig(text)
|
||||
const nextToc = {level, title: str}
|
||||
|
||||
if (/{docsify-ignore}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore}', '')
|
||||
nextToc.title = str
|
||||
nextToc.ignoreSubHeading = true
|
||||
}
|
||||
|
||||
if (/{docsify-ignore-all}/g.test(str)) {
|
||||
str = str.replace('{docsify-ignore-all}', '')
|
||||
nextToc.title = str
|
||||
nextToc.ignoreAllSubs = true
|
||||
}
|
||||
|
||||
const slug = slugify(config.id || str)
|
||||
const url = router.toURL(router.getCurrentPath(), {id: slug})
|
||||
nextToc.slug = url
|
||||
_self.toc.push(nextToc)
|
||||
|
||||
return `<h${level} id="${slug}"><a href="${url}" data-id="${slug}" class="anchor"><span>${str}</span></a></h${level}>`
|
||||
}
|
||||
// Highlight code
|
||||
origin.code = renderer.code = function (code, lang = '') {
|
||||
code = code.replace(/@DOCSIFY_QM@/g, '`')
|
||||
const hl = Prism.highlight(
|
||||
code,
|
||||
Prism.languages[lang] || Prism.languages.markup
|
||||
)
|
||||
|
||||
return `<pre v-pre data-lang="${lang}"><code class="lang-${lang}">${hl}</code></pre>`
|
||||
}
|
||||
origin.link = renderer.link = function (href, title = '', text) {
|
||||
let attrs = ''
|
||||
|
||||
const {str, config} = getAndRemoveConfig(title)
|
||||
title = str
|
||||
|
||||
if (
|
||||
!isAbsolutePath(href) &&
|
||||
!_self._matchNotCompileLink(href) &&
|
||||
!config.ignore
|
||||
) {
|
||||
if (href === _self.config.homepage) {
|
||||
href = 'README'
|
||||
}
|
||||
href = router.toURL(href, null, router.getCurrentPath())
|
||||
} else {
|
||||
attrs += href.indexOf('mailto:') === 0 ? '' : ` target="${linkTarget}"`
|
||||
}
|
||||
|
||||
if (config.target) {
|
||||
attrs += ' target=' + config.target
|
||||
}
|
||||
|
||||
if (config.disabled) {
|
||||
attrs += ' disabled'
|
||||
href = 'javascript:void(0)'
|
||||
}
|
||||
|
||||
if (title) {
|
||||
attrs += ` title="${title}"`
|
||||
}
|
||||
|
||||
return `<a href="${href}"${attrs}>${text}</a>`
|
||||
}
|
||||
origin.paragraph = renderer.paragraph = function (text) {
|
||||
let result
|
||||
if (/^!>/.test(text)) {
|
||||
result = helperTpl('tip', text)
|
||||
} else if (/^\?>/.test(text)) {
|
||||
result = helperTpl('warn', text)
|
||||
} else {
|
||||
result = `<p>${text}</p>`
|
||||
}
|
||||
return result
|
||||
}
|
||||
origin.image = renderer.image = function (href, title, text) {
|
||||
let url = href
|
||||
let attrs = ''
|
||||
|
||||
const {str, config} = getAndRemoveConfig(title)
|
||||
title = str
|
||||
|
||||
if (config['no-zoom']) {
|
||||
attrs += ' data-no-zoom'
|
||||
}
|
||||
|
||||
if (title) {
|
||||
attrs += ` title="${title}"`
|
||||
}
|
||||
|
||||
const size = config.size
|
||||
if (size) {
|
||||
const sizes = size.split('x')
|
||||
if (sizes[1]) {
|
||||
attrs += 'width=' + sizes[0] + ' height=' + sizes[1]
|
||||
} else {
|
||||
attrs += 'width=' + sizes[0]
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAbsolutePath(href)) {
|
||||
url = getPath(contentBase, getParentPath(router.getCurrentPath()), href)
|
||||
}
|
||||
|
||||
return `<img src="${url}"data-origin="${href}" alt="${text}"${attrs}>`
|
||||
}
|
||||
origin.list = renderer.list = function (body, ordered, start) {
|
||||
const isTaskList = /<li class="task-list-item">/.test(body.split('class="task-list"')[0])
|
||||
const isStartReq = start && start > 1
|
||||
const tag = ordered ? 'ol' : 'ul'
|
||||
const tagAttrs = [
|
||||
(isTaskList ? 'class="task-list"' : ''),
|
||||
(isStartReq ? `start="${start}"` : '')
|
||||
].join(' ').trim()
|
||||
|
||||
return `<${tag} ${tagAttrs}>${body}</${tag}>`
|
||||
}
|
||||
origin.listitem = renderer.listitem = function (text) {
|
||||
const isTaskItem = /^(<input.*type="checkbox"[^>]*>)/.test(text)
|
||||
const html = isTaskItem ? `<li class="task-list-item"><label>${text}</label></li>` : `<li>${text}</li>`
|
||||
|
||||
return html
|
||||
}
|
||||
|
||||
renderer.origin = origin
|
||||
|
||||
return renderer
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile sidebar
|
||||
*/
|
||||
sidebar(text, level) {
|
||||
const {toc} = this
|
||||
const currentPath = this.router.getCurrentPath()
|
||||
let html = ''
|
||||
|
||||
if (text) {
|
||||
html = this.compile(text)
|
||||
} else {
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
if (toc[i].ignoreSubHeading) {
|
||||
const deletedHeaderLevel = toc[i].level
|
||||
toc.splice(i, 1)
|
||||
// Remove headers who are under current header
|
||||
for (let j = i; deletedHeaderLevel < toc[j].level && j < toc.length; j++) {
|
||||
toc.splice(j, 1) && j-- && i++
|
||||
}
|
||||
i--
|
||||
}
|
||||
}
|
||||
const tree = this.cacheTree[currentPath] || genTree(toc, level)
|
||||
html = treeTpl(tree, '<ul>{inner}</ul>')
|
||||
this.cacheTree[currentPath] = tree
|
||||
}
|
||||
|
||||
return html
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile sub sidebar
|
||||
*/
|
||||
subSidebar(level) {
|
||||
if (!level) {
|
||||
this.toc = []
|
||||
return
|
||||
}
|
||||
const currentPath = this.router.getCurrentPath()
|
||||
const {cacheTree, toc} = this
|
||||
|
||||
toc[0] && toc[0].ignoreAllSubs && toc.splice(0)
|
||||
toc[0] && toc[0].level === 1 && toc.shift()
|
||||
const tree = genTree(TOC[currentPath] || toc, level)
|
||||
el.parentNode.innerHTML += treeTpl(tree, '<ul class="app-sub-sidebar">')
|
||||
|
||||
for (let i = 0; i < toc.length; i++) {
|
||||
toc[i].ignoreSubHeading && toc.splice(i, 1) && i--
|
||||
}
|
||||
const tree = cacheTree[currentPath] || genTree(toc, level)
|
||||
|
||||
cacheTree[currentPath] = tree
|
||||
this.toc = []
|
||||
return treeTpl(tree)
|
||||
}
|
||||
if (toc.length) {
|
||||
TOC[currentPath] = toc.slice()
|
||||
|
||||
article(text) {
|
||||
return this.compile(text)
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile cover page
|
||||
*/
|
||||
cover(text) {
|
||||
const cacheToc = this.toc.slice()
|
||||
const html = this.compile(text)
|
||||
|
||||
this.toc = cacheToc.slice()
|
||||
|
||||
return html
|
||||
}
|
||||
toc = []
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile cover page
|
||||
*/
|
||||
export function cover (text) {
|
||||
const cacheToc = toc.slice()
|
||||
const html = markdown(text)
|
||||
|
||||
toc = cacheToc.slice()
|
||||
|
||||
return html
|
||||
}
|
||||
|
|
|
|||
115
src/core/render/embed.js
Normal file
115
src/core/render/embed.js
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
import {get} from '../fetch/ajax'
|
||||
import {merge} from '../util/core'
|
||||
|
||||
const cached = {}
|
||||
|
||||
function walkFetchEmbed({embedTokens, compile, fetch}, cb) {
|
||||
let token
|
||||
let step = 0
|
||||
let count = 1
|
||||
|
||||
if (!embedTokens.length) {
|
||||
return cb({})
|
||||
}
|
||||
|
||||
while ((token = embedTokens[step++])) {
|
||||
const next = (function (token) {
|
||||
return text => {
|
||||
let embedToken
|
||||
if (text) {
|
||||
if (token.embed.type === 'markdown') {
|
||||
embedToken = compile.lexer(text)
|
||||
} else if (token.embed.type === 'code') {
|
||||
if (token.embed.fragment) {
|
||||
const fragment = token.embed.fragment
|
||||
const pattern = new RegExp(`(?:###|\\/\\/\\/)\\s*\\[${fragment}\\]([\\s\\S]*)(?:###|\\/\\/\\/)\\s*\\[${fragment}\\]`)
|
||||
text = ((text.match(pattern) || [])[1] || '').trim()
|
||||
}
|
||||
embedToken = compile.lexer(
|
||||
'```' +
|
||||
token.embed.lang +
|
||||
'\n' +
|
||||
text.replace(/`/g, '@DOCSIFY_QM@') +
|
||||
'\n```\n'
|
||||
)
|
||||
} else if (token.embed.type === 'mermaid') {
|
||||
embedToken = [
|
||||
{type: 'html', text: `<div class="mermaid">\n${text}\n</div>`}
|
||||
]
|
||||
embedToken.links = {}
|
||||
} else {
|
||||
embedToken = [{type: 'html', text}]
|
||||
embedToken.links = {}
|
||||
}
|
||||
}
|
||||
cb({token, embedToken})
|
||||
if (++count >= step) {
|
||||
cb({})
|
||||
}
|
||||
}
|
||||
})(token)
|
||||
|
||||
if (token.embed.url) {
|
||||
if (process.env.SSR) {
|
||||
fetch(token.embed.url).then(next)
|
||||
} else {
|
||||
get(token.embed.url).then(next)
|
||||
}
|
||||
} else {
|
||||
next(token.embed.html)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function prerenderEmbed({compiler, raw = '', fetch}, done) {
|
||||
let hit = cached[raw]
|
||||
if (hit) {
|
||||
const copy = hit.slice()
|
||||
copy.links = hit.links
|
||||
return done(copy)
|
||||
}
|
||||
|
||||
const compile = compiler._marked
|
||||
let tokens = compile.lexer(raw)
|
||||
const embedTokens = []
|
||||
const linkRE = compile.InlineLexer.rules.link
|
||||
const links = tokens.links
|
||||
|
||||
tokens.forEach((token, index) => {
|
||||
if (token.type === 'paragraph') {
|
||||
token.text = token.text.replace(
|
||||
new RegExp(linkRE.source, 'g'),
|
||||
(src, filename, href, title) => {
|
||||
const embed = compiler.compileEmbed(href, title)
|
||||
|
||||
if (embed) {
|
||||
embedTokens.push({
|
||||
index,
|
||||
embed
|
||||
})
|
||||
}
|
||||
|
||||
return src
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
let moveIndex = 0
|
||||
walkFetchEmbed({compile, embedTokens, fetch}, ({embedToken, token}) => {
|
||||
if (token) {
|
||||
const index = token.index + moveIndex
|
||||
|
||||
merge(links, embedToken.links)
|
||||
|
||||
tokens = tokens
|
||||
.slice(0, index)
|
||||
.concat(embedToken, tokens.slice(index + 1))
|
||||
moveIndex += embedToken.length - 1
|
||||
} else {
|
||||
cached[raw] = tokens.concat()
|
||||
tokens.links = cached[raw].links = links
|
||||
done(tokens)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -1,6 +1,12 @@
|
|||
export function emojify (text) {
|
||||
import {inBrowser} from '../util/env'
|
||||
|
||||
function replace(m, $1) {
|
||||
return '<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/' + $1 + '.png" alt="' + $1 + '" />'
|
||||
}
|
||||
|
||||
export function emojify(text) {
|
||||
return text
|
||||
.replace(/<(pre|template)[^>]*?>([\s\S]+)<\/(pre|template)>/g, m => m.replace(/:/g, '__colon__'))
|
||||
.replace(/:(\w+?):/ig, '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/$1.png" alt="$1" />')
|
||||
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m => m.replace(/:/g, '__colon__'))
|
||||
.replace(/:(\w+?):/ig, (inBrowser && window.emojify) || replace)
|
||||
.replace(/__colon__/g, ':')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* gen toc tree
|
||||
* Gen toc tree
|
||||
* @link https://github.com/killercup/grock/blob/5280ae63e16c5739e9233d9009bc235ed7d79a50/styles/solarized/assets/js/behavior.coffee#L54-L81
|
||||
* @param {Array} toc
|
||||
* @param {Number} maxLevel
|
||||
* @return {Array}
|
||||
*/
|
||||
export function genTree (toc, maxLevel) {
|
||||
export function genTree(toc, maxLevel) {
|
||||
const headlines = []
|
||||
const last = {}
|
||||
|
||||
|
|
@ -13,10 +13,11 @@ export function genTree (toc, maxLevel) {
|
|||
const level = headline.level || 1
|
||||
const len = level - 1
|
||||
|
||||
if (level > maxLevel) return
|
||||
if (level > maxLevel) {
|
||||
return
|
||||
}
|
||||
if (last[len]) {
|
||||
last[len].children = last[len].children || []
|
||||
last[len].children.push(headline)
|
||||
last[len].children = (last[len].children || []).concat(headline)
|
||||
} else {
|
||||
headlines.push(headline)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +1,59 @@
|
|||
import * as dom from '../util/dom'
|
||||
import { getAndActive, sticky } from '../event/sidebar'
|
||||
import { scrollActiveSidebar, scroll2Top } from '../event/scroll'
|
||||
import cssVars from '../util/polyfill/css-vars'
|
||||
import * as tpl from './tpl'
|
||||
import { markdown, sidebar, subSidebar, cover } from './compiler'
|
||||
import { callHook } from '../init/lifecycle'
|
||||
import { getBasePath, getPath, isAbsolutePath } from '../route/util'
|
||||
import cssVars from '../util/polyfill/css-vars'
|
||||
import tinydate from 'tinydate'
|
||||
import {callHook} from '../init/lifecycle'
|
||||
import {Compiler} from './compiler'
|
||||
import {getAndActive, sticky} from '../event/sidebar'
|
||||
import {getPath, isAbsolutePath} from '../router/util'
|
||||
import {isMobile, inBrowser} from '../util/env'
|
||||
import {isPrimitive} from '../util/core'
|
||||
import {scrollActiveSidebar, scroll2Top} from '../event/scroll'
|
||||
import {prerenderEmbed} from './embed'
|
||||
|
||||
function executeScript () {
|
||||
const script = dom.findAll('.markdown-section>script')
|
||||
.filter(s => !/template/.test(s.type))[0]
|
||||
if (!script) return false
|
||||
function executeScript() {
|
||||
const script = dom
|
||||
.findAll('.markdown-section>script')
|
||||
.filter(s => !/template/.test(s.type))[0]
|
||||
if (!script) {
|
||||
return false
|
||||
}
|
||||
const code = script.innerText.trim()
|
||||
if (!code) return false
|
||||
if (!code) {
|
||||
return false
|
||||
}
|
||||
|
||||
setTimeout(_ => {
|
||||
window.__EXECUTE_RESULT__ = new Function(code)()
|
||||
}, 0)
|
||||
}
|
||||
|
||||
function renderMain (html) {
|
||||
function formatUpdated(html, updated, fn) {
|
||||
updated =
|
||||
typeof fn === 'function' ?
|
||||
fn(updated) :
|
||||
typeof fn === 'string' ?
|
||||
tinydate(fn)(new Date(updated)) :
|
||||
updated
|
||||
|
||||
return html.replace(/{docsify-updated}/g, updated)
|
||||
}
|
||||
|
||||
function renderMain(html) {
|
||||
if (!html) {
|
||||
// TODO: Custom 404 page
|
||||
html = 'not found'
|
||||
html = '<h1>404 - Not found</h1>'
|
||||
}
|
||||
|
||||
this._renderTo('.markdown-section', html)
|
||||
// Render sidebar with the TOC
|
||||
!this.config.loadSidebar && this._renderSidebar()
|
||||
|
||||
// execute script
|
||||
if (this.config.executeScript !== false &&
|
||||
typeof window.Vue !== 'undefined' &&
|
||||
!executeScript()) {
|
||||
// Execute script
|
||||
if (
|
||||
this.config.executeScript !== false &&
|
||||
typeof window.Vue !== 'undefined' &&
|
||||
!executeScript()
|
||||
) {
|
||||
setTimeout(_ => {
|
||||
const vueVM = window.__EXECUTE_RESULT__
|
||||
vueVM && vueVM.$destroy && vueVM.$destroy()
|
||||
|
|
@ -41,61 +62,124 @@ function renderMain (html) {
|
|||
} else {
|
||||
this.config.executeScript && executeScript()
|
||||
}
|
||||
}
|
||||
|
||||
if (this.config.auto2top) {
|
||||
scroll2Top(this.config.auto2top)
|
||||
function renderNameLink(vm) {
|
||||
const el = dom.getNode('.app-name-link')
|
||||
const nameLink = vm.config.nameLink
|
||||
const path = vm.route.path
|
||||
|
||||
if (!el) {
|
||||
return
|
||||
}
|
||||
|
||||
if (isPrimitive(vm.config.nameLink)) {
|
||||
el.setAttribute('href', nameLink)
|
||||
} else if (typeof nameLink === 'object') {
|
||||
const match = Object.keys(nameLink).filter(key => path.indexOf(key) > -1)[0]
|
||||
|
||||
el.setAttribute('href', nameLink[match])
|
||||
}
|
||||
}
|
||||
|
||||
export function renderMixin (proto) {
|
||||
export function renderMixin(proto) {
|
||||
proto._renderTo = function (el, content, replace) {
|
||||
const node = dom.getNode(el)
|
||||
if (node) node[replace ? 'outerHTML' : 'innerHTML'] = content
|
||||
if (node) {
|
||||
node[replace ? 'outerHTML' : 'innerHTML'] = content
|
||||
}
|
||||
}
|
||||
|
||||
proto._renderSidebar = function (text) {
|
||||
const { maxLevel, subMaxLevel, autoHeader, loadSidebar } = this.config
|
||||
const {maxLevel, subMaxLevel, loadSidebar} = this.config
|
||||
|
||||
this._renderTo('.sidebar-nav', sidebar(text, maxLevel))
|
||||
const active = getAndActive('.sidebar-nav', true, true)
|
||||
loadSidebar && subSidebar(active, subMaxLevel)
|
||||
// bind event
|
||||
this.activeLink = active
|
||||
scrollActiveSidebar()
|
||||
this._renderTo('.sidebar-nav', this.compiler.sidebar(text, maxLevel))
|
||||
const activeEl = getAndActive(this.router, '.sidebar-nav', true, true)
|
||||
if (loadSidebar && activeEl) {
|
||||
activeEl.parentNode.innerHTML +=
|
||||
this.compiler.subSidebar(subMaxLevel) || ''
|
||||
} else {
|
||||
// Reset toc
|
||||
this.compiler.subSidebar()
|
||||
}
|
||||
// Bind event
|
||||
this._bindEventOnRendered(activeEl)
|
||||
}
|
||||
|
||||
if (autoHeader && active) {
|
||||
proto._bindEventOnRendered = function (activeEl) {
|
||||
const {autoHeader, auto2top} = this.config
|
||||
|
||||
scrollActiveSidebar(this.router)
|
||||
|
||||
if (autoHeader && activeEl) {
|
||||
const main = dom.getNode('#main')
|
||||
const firstNode = main.children[0]
|
||||
if (firstNode && firstNode.tagName !== 'H1') {
|
||||
const h1 = dom.create('h1')
|
||||
h1.innerText = active.innerText
|
||||
h1.innerText = activeEl.innerText
|
||||
dom.before(main, h1)
|
||||
}
|
||||
}
|
||||
|
||||
auto2top && scroll2Top(auto2top)
|
||||
}
|
||||
|
||||
proto._renderNav = function (text) {
|
||||
text && this._renderTo('nav', markdown(text))
|
||||
getAndActive('nav')
|
||||
text && this._renderTo('nav', this.compiler.compile(text))
|
||||
if (this.config.loadNavbar) {
|
||||
getAndActive(this.router, 'nav')
|
||||
}
|
||||
}
|
||||
|
||||
proto._renderMain = function (text) {
|
||||
proto._renderMain = function (text, opt = {}, next) {
|
||||
if (!text) {
|
||||
return renderMain.call(this, text)
|
||||
}
|
||||
|
||||
callHook(this, 'beforeEach', text, result => {
|
||||
const html = this.isHTML ? result : markdown(result)
|
||||
callHook(this, 'afterEach', html, text => renderMain.call(this, text))
|
||||
let html
|
||||
const callback = () => {
|
||||
if (opt.updatedAt) {
|
||||
html = formatUpdated(html, opt.updatedAt, this.config.formatUpdated)
|
||||
}
|
||||
|
||||
callHook(this, 'afterEach', html, text => renderMain.call(this, text))
|
||||
}
|
||||
if (this.isHTML) {
|
||||
html = this.result = text
|
||||
callback()
|
||||
next()
|
||||
} else {
|
||||
prerenderEmbed(
|
||||
{
|
||||
compiler: this.compiler,
|
||||
raw: result
|
||||
},
|
||||
tokens => {
|
||||
html = this.compiler.compile(tokens)
|
||||
callback()
|
||||
next()
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
proto._renderCover = function (text) {
|
||||
proto._renderCover = function (text, coverOnly) {
|
||||
const el = dom.getNode('.cover')
|
||||
|
||||
dom.toggleClass(dom.getNode('main'), coverOnly ? 'add' : 'remove', 'hidden')
|
||||
if (!text) {
|
||||
dom.toggleClass(el, 'remove', 'show')
|
||||
return
|
||||
}
|
||||
dom.toggleClass(el, 'add', 'show')
|
||||
|
||||
let html = this.coverIsHTML ? text : cover(text)
|
||||
const m = html.trim().match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$')
|
||||
let html = this.coverIsHTML ? text : this.compiler.cover(text)
|
||||
|
||||
const m = html
|
||||
.trim()
|
||||
.match('<p><img.*?data-origin="(.*?)"[^a]+alt="(.*?)">([^<]*?)</p>$')
|
||||
|
||||
if (m) {
|
||||
if (m[2] === 'color') {
|
||||
|
|
@ -104,10 +188,12 @@ export function renderMixin (proto) {
|
|||
let path = m[1]
|
||||
|
||||
dom.toggleClass(el, 'add', 'has-mask')
|
||||
if (isAbsolutePath(m[1])) {
|
||||
path = getPath(getBasePath(this.config.basePath), m[1])
|
||||
if (!isAbsolutePath(m[1])) {
|
||||
path = getPath(this.router.getBasePath(), m[1])
|
||||
}
|
||||
el.style.backgroundImage = `url(${path})`
|
||||
el.style.backgroundSize = 'cover'
|
||||
el.style.backgroundPosition = 'center center'
|
||||
}
|
||||
html = html.replace(m[0], '')
|
||||
}
|
||||
|
|
@ -117,48 +203,74 @@ export function renderMixin (proto) {
|
|||
}
|
||||
|
||||
proto._updateRender = function () {
|
||||
markdown.update()
|
||||
// Render name link
|
||||
renderNameLink(this)
|
||||
}
|
||||
}
|
||||
|
||||
export function initRender (vm) {
|
||||
export function initRender(vm) {
|
||||
const config = vm.config
|
||||
|
||||
// Init markdown compiler
|
||||
markdown.init(config.markdown, config.basePath)
|
||||
vm.compiler = new Compiler(config, vm.router)
|
||||
if (inBrowser) {
|
||||
window.__current_docsify_compiler__ = vm.compiler
|
||||
}
|
||||
|
||||
const id = config.el || '#app'
|
||||
const navEl = dom.find('nav') || dom.create('nav')
|
||||
|
||||
let el = dom.find(id)
|
||||
const el = dom.find(id)
|
||||
let html = ''
|
||||
let navAppendToTarget = dom.body
|
||||
|
||||
navEl.classList.add('app-nav')
|
||||
if (el) {
|
||||
if (config.repo) {
|
||||
html += tpl.corner(config.repo)
|
||||
}
|
||||
if (config.coverpage) {
|
||||
html += tpl.cover()
|
||||
}
|
||||
|
||||
if (!config.repo) {
|
||||
navEl.classList.add('no-badge')
|
||||
}
|
||||
if (!el) {
|
||||
el = dom.create(id)
|
||||
dom.appendTo(dom.body, el)
|
||||
}
|
||||
if (config.repo) {
|
||||
html += tpl.corner(config.repo)
|
||||
}
|
||||
if (config.coverpage) {
|
||||
html += tpl.cover()
|
||||
if (config.logo) {
|
||||
const isBase64 = /^data:image/.test(config.logo)
|
||||
const isExternal = /(?:http[s]?:)?\/\//.test(config.logo)
|
||||
const isRelative = /^\./.test(config.logo)
|
||||
|
||||
if (!isBase64 && !isExternal && !isRelative) {
|
||||
config.logo = getPath(vm.router.getBasePath(), config.logo)
|
||||
}
|
||||
}
|
||||
|
||||
html += tpl.main(config)
|
||||
// Render main app
|
||||
vm._renderTo(el, html, true)
|
||||
} else {
|
||||
vm.rendered = true
|
||||
}
|
||||
|
||||
if (config.mergeNavbar && isMobile) {
|
||||
navAppendToTarget = dom.find('.sidebar')
|
||||
} else {
|
||||
navEl.classList.add('app-nav')
|
||||
|
||||
if (!config.repo) {
|
||||
navEl.classList.add('no-badge')
|
||||
}
|
||||
}
|
||||
|
||||
html += tpl.main(config)
|
||||
// Render main app
|
||||
vm._renderTo(el, html, true)
|
||||
// Add nav
|
||||
dom.before(dom.body, navEl)
|
||||
if (config.loadNavbar) {
|
||||
dom.before(navAppendToTarget, navEl)
|
||||
}
|
||||
|
||||
if (config.themeColor) {
|
||||
dom.$.head.innerHTML += tpl.theme(config.themeColor)
|
||||
dom.$.head.appendChild(
|
||||
dom.create('div', tpl.theme(config.themeColor)).firstElementChild
|
||||
)
|
||||
// Polyfll
|
||||
cssVars(config.themeColor)
|
||||
}
|
||||
vm._updateRender()
|
||||
dom.toggleClass(dom.body, 'ready')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ let timeId
|
|||
/**
|
||||
* Init progress component
|
||||
*/
|
||||
function init () {
|
||||
function init() {
|
||||
const div = dom.create('div')
|
||||
|
||||
div.classList.add('progress')
|
||||
|
|
@ -16,7 +16,7 @@ function init () {
|
|||
/**
|
||||
* Render progress bar
|
||||
*/
|
||||
export default function ({ loaded, total, step }) {
|
||||
export default function ({loaded, total, step}) {
|
||||
let num
|
||||
|
||||
!barEl && init()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,20 @@
|
|||
import {hasOwn} from '../util/core'
|
||||
|
||||
let cache = {}
|
||||
const re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g
|
||||
const re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g
|
||||
|
||||
export function slugify (str) {
|
||||
if (typeof str !== 'string') return ''
|
||||
function lower(string) {
|
||||
return string.toLowerCase()
|
||||
}
|
||||
|
||||
let slug = str.toLowerCase().trim()
|
||||
export function slugify(str) {
|
||||
if (typeof str !== 'string') {
|
||||
return ''
|
||||
}
|
||||
|
||||
let slug = str
|
||||
.trim()
|
||||
.replace(/[A-Z]+/g, lower)
|
||||
.replace(/<[^>\d]+>/g, '')
|
||||
.replace(re, '')
|
||||
.replace(/\s/g, '-')
|
||||
|
|
@ -12,7 +22,7 @@ export function slugify (str) {
|
|||
.replace(/^(\d)/, '_$1')
|
||||
let count = cache[slug]
|
||||
|
||||
count = cache.hasOwnProperty(slug) ? (count + 1) : 0
|
||||
count = hasOwn.call(cache, slug) ? count + 1 : 0
|
||||
cache[slug] = count
|
||||
|
||||
if (count) {
|
||||
|
|
@ -22,6 +32,6 @@ export function slugify (str) {
|
|||
return slug
|
||||
}
|
||||
|
||||
export function clearSlugCache () {
|
||||
slugify.clear = function () {
|
||||
cache = {}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue