mirror of
https://github.com/zhigang1992/docsify.git
synced 2026-06-19 06:36:52 +08:00
feat(ssr): add render function
This commit is contained in:
@@ -57,6 +57,16 @@ export default class Renderer {
|
||||
return isAbsolutePath(file) ? file : cwd(`./${file}`)
|
||||
}
|
||||
|
||||
async render(url) {
|
||||
const content = await this.renderToString(url)
|
||||
|
||||
return {
|
||||
content,
|
||||
url: this.router.parse(url).path,
|
||||
path: this._getPath(url)
|
||||
}
|
||||
}
|
||||
|
||||
async renderToString(url) {
|
||||
this.url = url = this.router.parse(url).path
|
||||
const {loadSidebar, loadNavbar, coverpage} = this.config
|
||||
|
||||
Reference in New Issue
Block a user