-
Notifications
You must be signed in to change notification settings - Fork 3
/
plugins.js
34 lines (33 loc) · 1 KB
/
plugins.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function addPlugins(pluginList) {
let pluginConfig = {
ga: false,
search: false,
tags: "",
};
let scriptTags = "";
for (let i = 0; i < pluginList.length; i++) {
if (pluginList[i] == "docsify-copy-code") {
scriptTags +=
"<script src='//cdn.jsdelivr.net/npm/docsify-copy-code'></script>";
}
if (pluginList[i] == "full-text-search") {
scriptTags +=
"<script src='//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js'></script>";
pluginConfig.search = true;
}
if (pluginList[i] == "google-analytics") {
pluginConfig.ga = true;
}
if (pluginList[i] == "emoji") {
scriptTags +=
"<script src='//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js'></script>";
}
if (pluginList[i] == "zoom-image") {
scriptTags +=
"<script src='//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js'></script>";
}
}
pluginConfig.tags = scriptTags;
return pluginConfig;
}
module.exports = { addPlugins };