(html)
| 41 | } |
| 42 | |
| 43 | function renderMain(html) { |
| 44 | const docsifyConfig = this.config; |
| 45 | const markdownElm = dom.find('.markdown-section'); |
| 46 | const vueVersion = |
| 47 | 'Vue' in window && |
| 48 | window.Vue.version && |
| 49 | Number(window.Vue.version.charAt(0)); |
| 50 | |
| 51 | const isMountedVue = elm => { |
| 52 | const isVue2 = Boolean(elm.__vue__ && elm.__vue__._isVue); |
| 53 | const isVue3 = Boolean(elm._vnode && elm._vnode.__v_skip); |
| 54 | |
| 55 | return isVue2 || isVue3; |
| 56 | }; |
| 57 | |
| 58 | if (!html) { |
| 59 | html = '<h1>404 - Not found</h1>'; |
| 60 | } |
| 61 | |
| 62 | if ('Vue' in window) { |
| 63 | const mountedElms = dom |
| 64 | .findAll('.markdown-section > *') |
| 65 | .filter(elm => isMountedVue(elm)); |
| 66 | |
| 67 | // Destroy/unmount existing Vue instances |
| 68 | for (const mountedElm of mountedElms) { |
| 69 | if (vueVersion === 2) { |
| 70 | mountedElm.__vue__.$destroy(); |
| 71 | } else if (vueVersion === 3) { |
| 72 | mountedElm.__vue_app__.unmount(); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | this._renderTo(markdownElm, html); |
| 78 | |
| 79 | // Render sidebar with the TOC |
| 80 | !docsifyConfig.loadSidebar && this._renderSidebar(); |
| 81 | |
| 82 | // Execute markdown <script> |
| 83 | if ( |
| 84 | docsifyConfig.executeScript || |
| 85 | ('Vue' in window && docsifyConfig.executeScript !== false) |
| 86 | ) { |
| 87 | executeScript(); |
| 88 | } |
| 89 | |
| 90 | // Handle Vue content not mounted by markdown <script> |
| 91 | if ('Vue' in window) { |
| 92 | const vueMountData = []; |
| 93 | const vueComponentNames = Object.keys(docsifyConfig.vueComponents || {}); |
| 94 | |
| 95 | // Register global vueComponents |
| 96 | if (vueVersion === 2 && vueComponentNames.length) { |
| 97 | vueComponentNames.forEach(name => { |
| 98 | const isNotRegistered = !window.Vue.options.components[name]; |
| 99 | |
| 100 | if (isNotRegistered) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…