mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
Ensure autoHeader dom result is similar to parsed H1 (#811)
This commit is contained in:
parent
b83622e41a
commit
2928eb7e55
@ -82,6 +82,7 @@ export class Compiler {
|
||||
this.contentBase = router.getBasePath()
|
||||
|
||||
const renderer = this._initRenderer()
|
||||
this.heading = renderer.heading
|
||||
let compile
|
||||
const mdConf = config.markdown || {}
|
||||
|
||||
@ -403,6 +404,10 @@ export class Compiler {
|
||||
return treeTpl(tree)
|
||||
}
|
||||
|
||||
header(text, level) {
|
||||
return this.heading(text, level)
|
||||
}
|
||||
|
||||
article(text) {
|
||||
return this.compile(text)
|
||||
}
|
||||
|
||||
@ -117,9 +117,9 @@ export function renderMixin(proto) {
|
||||
const main = dom.getNode('#main')
|
||||
const firstNode = main.children[0]
|
||||
if (firstNode && firstNode.tagName !== 'H1') {
|
||||
const h1 = dom.create('h1')
|
||||
h1.innerText = activeEl.innerText
|
||||
dom.before(main, h1)
|
||||
const h1 = this.compiler.header(activeEl.innerText, 1)
|
||||
const wrapper = dom.create('div', h1)
|
||||
dom.before(main, wrapper.children[0])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user