Ensure autoHeader dom result is similar to parsed H1 (#811)

This commit is contained in:
cyrilf
2020-02-04 22:34:44 +05:30
committed by GitHub
parent b83622e41a
commit 2928eb7e55
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -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)
}
+3 -3
View File
@@ -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])
}
}