0.6.0 (#12)
* Fix ineffective option, fixed #10 * Feat: dropdown list, #6 * Fix repo url * Feat: sidebar with toggle * Update doc
This commit is contained in:
parent
dd361b34b9
commit
d07ddaa85d
12 changed files with 380 additions and 24 deletions
|
|
@ -6,6 +6,7 @@ const OPTIONS = {
|
|||
repo: '',
|
||||
maxLevel: 6,
|
||||
sidebar: '',
|
||||
sidebarToggle: false,
|
||||
loadSidebar: null,
|
||||
loadNavbar: null
|
||||
}
|
||||
|
|
@ -15,7 +16,7 @@ const script = document.currentScript || [].slice.call(document.getElementsByTag
|
|||
if (script) {
|
||||
for (const prop in OPTIONS) {
|
||||
const val = script.getAttribute('data-' + camel2kebab(prop))
|
||||
OPTIONS[prop] = isNil(val) ? OPTIONS[prop] : true
|
||||
OPTIONS[prop] = isNil(val) ? OPTIONS[prop] : (val || true)
|
||||
}
|
||||
if (OPTIONS.loadSidebar === true) OPTIONS.loadSidebar = '_sidebar.md'
|
||||
if (OPTIONS.loadNavbar === true) OPTIONS.loadNavbar = '_navbar.md'
|
||||
|
|
@ -34,7 +35,8 @@ const Docsify = function () {
|
|||
|
||||
// Render markdown file
|
||||
load(`${loc}.md`)
|
||||
.then(render.renderArticle, _ => render.renderArticle())
|
||||
.then(content => render.renderArticle(content, OPTIONS),
|
||||
_ => render.renderArticle(null, OPTIONS))
|
||||
|
||||
// Render sidebar
|
||||
if (OPTIONS.loadSidebar) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue