From 0a84ab78ef934a11b4149d19d2ccc9d273cac9d0 Mon Sep 17 00:00:00 2001 From: Anirudh Emmadi Date: Tue, 18 Aug 2020 16:15:34 -0500 Subject: [PATCH] feat: added support for plugins (#2) --- docsify.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docsify.js b/docsify.js index aaafdb9..a05225b 100644 --- a/docsify.js +++ b/docsify.js @@ -1,5 +1,26 @@ +// Generates docsify enabled html with no config function generateHTML(user, repo) { return `${repo}
`; } -module.exports = { generateHTML }; +// Generated docsify enabled html with config and plugins +function generateHtmlWithConfig(config) { + if (config.enablePlugins) { + let ga = ""; // google analytics code + let search = ""; // search path + + if (config.plugins.ga) { + ga = `, ga: ${config.gaCode}`; + } + if (config.plugins.search) { + search = ', search: ["/"]'; + } + + return `${config.repo}
${config.plugins.tags}`; + } + + // If no plugins, but config exists for description + return `${config.repo}
`; +} + +module.exports = { generateHTML, generateHtmlWithConfig };