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 };