/* eslint-disable no-unused-vars */ import tinydate from 'tinydate'; import * as dom from '../util/dom.js'; import { getPath, isAbsolutePath } from '../router/util.js'; import { isMobile, inBrowser } from '../util/env.js'; import { isPrimitive } from '../util/core.js'; import { Compiler } from './compiler.js'; import * as tpl from './tpl.js'; import { prerenderEmbed } from './embed.js'; /** @typedef {import('../Docsify.js').Constructor} Constructor */ /** * @template {!Constructor} T * @param {T} Base - The class to extend */ export function Render(Base) { return class Render extends Base { #vueGlobalData; #executeScript() { const script = dom .findAll('.markdown-section>script') .filter(s => !/template/.test(s.type))[0]; if (!script) { return false; } const code = script.innerText.trim(); if (!code) { return false; } new Function(code)(); } #formatUpdated(html, updated, fn) { updated = typeof fn === 'function' ? fn(updated) : typeof fn === 'string' ? tinydate(fn)(new Date(updated)) : updated; return html.replace(/{docsify-updated}/g, updated); } #renderMain(html) { const docsifyConfig = this.config; const markdownElm = dom.find('.markdown-section'); const vueVersion = 'Vue' in window && window.Vue.version && Number(window.Vue.version.charAt(0)); const isMountedVue = elm => { const isVue2 = Boolean(elm.__vue__ && elm.__vue__._isVue); const isVue3 = Boolean(elm._vnode && elm._vnode.__v_skip); return isVue2 || isVue3; }; if (!html) { html = /* html */ `