@remloyal/docsify-plugins 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +72 -0
- package/dist/flexsearch/docsify-flexsearch.css +248 -0
- package/dist/flexsearch/docsify-flexsearch.js +4614 -0
- package/dist/flexsearch/docsify-flexsearch.min.css +2 -0
- package/dist/flexsearch/docsify-flexsearch.min.css.map +1 -0
- package/dist/flexsearch/docsify-flexsearch.min.js +8 -0
- package/dist/flexsearch/docsify-flexsearch.min.js.map +1 -0
- package/dist/sidebar-collapse/docsify-sidebar-collapse.css +25 -0
- package/dist/sidebar-collapse/docsify-sidebar-collapse.js +193 -0
- package/dist/sidebar-collapse/docsify-sidebar-collapse.min.css +2 -0
- package/dist/sidebar-collapse/docsify-sidebar-collapse.min.css.map +1 -0
- package/dist/sidebar-collapse/docsify-sidebar-collapse.min.js +8 -0
- package/dist/sidebar-collapse/docsify-sidebar-collapse.min.js.map +1 -0
- package/package.json +60 -0
- package/src/flexsearch/index.js +822 -0
- package/src/flexsearch/markdown-to-txt.js +206 -0
- package/src/flexsearch/style.css +247 -0
- package/src/sidebar-collapse/index.js +11 -0
- package/src/sidebar-collapse/sidebar-collapse-plugin.js +251 -0
- package/src/sidebar-collapse/sidebar.css +27 -0
- package/src/sidebar-collapse/style.css +25 -0
- package/src/utils/utils.js +96 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.sidebar-nav li {
|
|
2
|
+
position: relative;
|
|
3
|
+
margin: 0;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.sidebar-nav ul:not(.app-sub-sidebar) > li:not(.file)::before {
|
|
8
|
+
content: '';
|
|
9
|
+
display: block;
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 11px;
|
|
12
|
+
left: -12px;
|
|
13
|
+
height: 6px;
|
|
14
|
+
width: 6px;
|
|
15
|
+
border-right: 1px solid #505d6b;
|
|
16
|
+
border-bottom: 1px solid #505d6b;
|
|
17
|
+
transform: rotate(-45deg);
|
|
18
|
+
transition: transform 0.1s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sidebar-nav ul:not(.app-sub-sidebar) > li.open::before {
|
|
22
|
+
transform: rotate(45deg);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.sidebar-nav ul:not(.app-sub-sidebar) > li.collapse::before {
|
|
26
|
+
transform: rotate(-45deg);
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.sidebar-nav > ul > li ul {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.app-sub-sidebar {
|
|
6
|
+
display: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.app-sub-sidebar.open {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sidebar-nav .open > ul:not(.app-sub-sidebar),
|
|
14
|
+
.sidebar-nav .active:not(.collapse) > ul {
|
|
15
|
+
display: block;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* 抖动 */
|
|
19
|
+
.sidebar-nav li.open:not(.collapse) > ul {
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.active + ul.app-sub-sidebar {
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a colon formatted string to a object with properties.
|
|
3
|
+
*
|
|
4
|
+
* This is process a provided string and look for any tokens in the format
|
|
5
|
+
* of `:name[=value]` and then convert it to a object and return.
|
|
6
|
+
* An example of this is ':include :type=code :fragment=demo' is taken and
|
|
7
|
+
* then converted to:
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* {
|
|
11
|
+
* include: '',
|
|
12
|
+
* type: 'code',
|
|
13
|
+
* fragment: 'demo'
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param {string} str The string to parse.
|
|
18
|
+
*
|
|
19
|
+
* @return {{str: string, config: Record<string, string | string[]>}} The original string formatted, and parsed object, { str, config }.
|
|
20
|
+
*/
|
|
21
|
+
export function getAndRemoveConfig(str = '') {
|
|
22
|
+
/** @type {Record<string, string | string[]>} */
|
|
23
|
+
const config = {};
|
|
24
|
+
|
|
25
|
+
if (str) {
|
|
26
|
+
str = str
|
|
27
|
+
.replace(/^('|")/, '')
|
|
28
|
+
.replace(/('|")$/, '')
|
|
29
|
+
.replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g, (m, key, value) => {
|
|
30
|
+
if (key.indexOf(':') !== -1) {
|
|
31
|
+
return m;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
value = (value && value.replace(/"/g, '')) || true;
|
|
35
|
+
|
|
36
|
+
if (value !== true && config[key] !== undefined) {
|
|
37
|
+
if (!Array.isArray(config[key]) && value !== config[key]) {
|
|
38
|
+
config[key] = [config[key]];
|
|
39
|
+
}
|
|
40
|
+
config[key].includes(value) ||
|
|
41
|
+
/** @type {string[]} */ (config[key]).push(value);
|
|
42
|
+
} else {
|
|
43
|
+
config[key] = value;
|
|
44
|
+
}
|
|
45
|
+
return '';
|
|
46
|
+
})
|
|
47
|
+
.trim();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return { str, config };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Remove the <a> tag from sidebar when the header with link, details see issue 1069
|
|
55
|
+
* @param {string} str The string to deal with.
|
|
56
|
+
*
|
|
57
|
+
* @return {string} The string after delete the <a> element.
|
|
58
|
+
*/
|
|
59
|
+
export function removeAtag(str = '') {
|
|
60
|
+
return str.replace(/(<\/?a.*?>)/gi, '');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Remove the docsifyIgnore configs and return the str
|
|
65
|
+
* @param {string} content The string to deal with.
|
|
66
|
+
*
|
|
67
|
+
* @return {{content: string, ignoreAllSubs: boolean, ignoreSubHeading: boolean}} The string after delete the docsifyIgnore configs, and whether to ignore some or all.
|
|
68
|
+
*/
|
|
69
|
+
export function getAndRemoveDocsifyIgnoreConfig(content = '') {
|
|
70
|
+
let ignoreAllSubs, ignoreSubHeading;
|
|
71
|
+
if (/<!-- {docsify-ignore} -->/g.test(content)) {
|
|
72
|
+
content = content.replace('<!-- {docsify-ignore} -->', '');
|
|
73
|
+
ignoreSubHeading = true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (/{docsify-ignore}/g.test(content)) {
|
|
77
|
+
content = content.replace('{docsify-ignore}', '');
|
|
78
|
+
ignoreSubHeading = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (/<!-- {docsify-ignore-all} -->/g.test(content)) {
|
|
82
|
+
content = content.replace('<!-- {docsify-ignore-all} -->', '');
|
|
83
|
+
ignoreAllSubs = true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (/{docsify-ignore-all}/g.test(content)) {
|
|
87
|
+
content = content.replace('{docsify-ignore-all}', '');
|
|
88
|
+
ignoreAllSubs = true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return /** @type {{content: string, ignoreAllSubs: boolean, ignoreSubHeading: boolean}} */ ({
|
|
92
|
+
content,
|
|
93
|
+
ignoreAllSubs,
|
|
94
|
+
ignoreSubHeading,
|
|
95
|
+
});
|
|
96
|
+
}
|