1.3 (#38)
* Add cover page * Update doc * Add kbd style, resolve #37 * headling can cliked, resolve #36 * Update change log, close #35 * Update docs
This commit is contained in:
parent
b14fcf7d1c
commit
50addfdac6
14 changed files with 312 additions and 48 deletions
14
src/index.js
14
src/index.js
|
|
@ -1,5 +1,5 @@
|
|||
import { load, camel2kebab, isNil, getRoute } from './util'
|
||||
import { activeLink, scrollIntoView } from './event'
|
||||
import { activeLink, scrollIntoView, sticky } from './event'
|
||||
import * as render from './render'
|
||||
|
||||
const OPTIONS = {
|
||||
|
|
@ -12,6 +12,7 @@ const OPTIONS = {
|
|||
loadNavbar: null,
|
||||
router: false,
|
||||
homepage: 'README.md',
|
||||
coverpage: '',
|
||||
basePath: '',
|
||||
auto2top: false
|
||||
}
|
||||
|
|
@ -25,6 +26,7 @@ if (script) {
|
|||
}
|
||||
if (OPTIONS.loadSidebar === true) OPTIONS.loadSidebar = '_sidebar.md'
|
||||
if (OPTIONS.loadNavbar === true) OPTIONS.loadNavbar = '_navbar.md'
|
||||
if (OPTIONS.coverpage === true) OPTIONS.coverpage = '_coverpage.md'
|
||||
if (OPTIONS.sidebar) OPTIONS.sidebar = window[OPTIONS.sidebar]
|
||||
}
|
||||
|
||||
|
|
@ -56,6 +58,15 @@ const mainRender = function (cb) {
|
|||
page = `${route}.md`
|
||||
}
|
||||
|
||||
// Render Cover page
|
||||
if (OPTIONS.coverpage) {
|
||||
if (page === OPTIONS.homepage) {
|
||||
load(OPTIONS.coverpage).then(render.renderCover)
|
||||
} else {
|
||||
render.renderCover()
|
||||
}
|
||||
}
|
||||
|
||||
cacheXhr && cacheXhr.abort && cacheXhr.abort()
|
||||
// Render markdown file
|
||||
cacheXhr = load(page, 'GET', render.renderLoading)
|
||||
|
|
@ -91,6 +102,7 @@ const Docsify = function () {
|
|||
mainRender(_ => {
|
||||
activeLink('aside.sidebar', true)
|
||||
scrollIntoView()
|
||||
OPTIONS.coverpage && sticky()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue