()
| 397 | } |
| 398 | |
| 399 | initRender() { |
| 400 | const config = this.config; |
| 401 | |
| 402 | // Init markdown compiler |
| 403 | this.compiler = new Compiler(config, this.router); |
| 404 | if (inBrowser) { |
| 405 | /* eslint-disable-next-line camelcase */ |
| 406 | window.__current_docsify_compiler__ = this.compiler; |
| 407 | } |
| 408 | |
| 409 | const id = config.el || '#app'; |
| 410 | const navEl = dom.find('nav') || dom.create('nav'); |
| 411 | |
| 412 | const el = dom.find(id); |
| 413 | let html = ''; |
| 414 | let navAppendToTarget = dom.body; |
| 415 | |
| 416 | if (el) { |
| 417 | if (config.repo) { |
| 418 | html += tpl.corner(config.repo, config.cornerExternalLinkTarget); |
| 419 | } |
| 420 | |
| 421 | if (config.coverpage) { |
| 422 | html += tpl.cover(); |
| 423 | } |
| 424 | |
| 425 | if (config.logo) { |
| 426 | const isBase64 = /^data:image/.test(config.logo); |
| 427 | const isExternal = /(?:http[s]?:)?\/\//.test(config.logo); |
| 428 | const isRelative = /^\./.test(config.logo); |
| 429 | |
| 430 | if (!isBase64 && !isExternal && !isRelative) { |
| 431 | config.logo = getPath(this.router.getBasePath(), config.logo); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | html += tpl.main(config); |
| 436 | // Render main app |
| 437 | this._renderTo(el, html, true); |
| 438 | } else { |
| 439 | this.rendered = true; |
| 440 | } |
| 441 | |
| 442 | if (config.mergeNavbar && isMobile) { |
| 443 | navAppendToTarget = dom.find('.sidebar'); |
| 444 | } else { |
| 445 | navEl.classList.add('app-nav'); |
| 446 | |
| 447 | if (!config.repo) { |
| 448 | navEl.classList.add('no-badge'); |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | // Add nav |
| 453 | if (config.loadNavbar) { |
| 454 | dom.before(navAppendToTarget, navEl); |
| 455 | } |
| 456 |
no test coverage detected