UNPKG

vue-files-preview-inno

Version:

A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.

39 lines (38 loc) 1.24 kB
import p from "../common/html_blocks.mjs"; import { HTML_OPEN_CLOSE_TAG_RE as s } from "../common/html_re.mjs"; const f = [ [/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, !0], [/^<!--/, /-->/, !0], [/^<\?/, /\?>/, !0], [/^<![A-Z]/, />/, !0], [/^<!\[CDATA\[/, /\]\]>/, !0], [new RegExp("^</?(" + p.join("|") + ")(?=(\\s|/?>|$))", "i"), /^$/, !0], [new RegExp(s.source + "\\s*$"), /^$/, !1] ]; function h(e, l, c, k) { let o = e.bMarks[l] + e.tShift[l], u = e.eMarks[l]; if (e.sCount[l] - e.blkIndent >= 4 || !e.md.options.html || e.src.charCodeAt(o) !== 60) return !1; let i = e.src.slice(o, u), n = 0; for (; n < f.length && !f[n][0].test(i); n++) ; if (n === f.length) return !1; if (k) return f[n][2]; let r = l + 1; if (!f[n][1].test(i)) { for (; r < c && !(e.sCount[r] < e.blkIndent); r++) if (o = e.bMarks[r] + e.tShift[r], u = e.eMarks[r], i = e.src.slice(o, u), f[n][1].test(i)) { i.length !== 0 && r++; break; } } e.line = r; const t = e.push("html_block", "", 0); return t.map = [l, r], t.content = e.getLines(l, r, e.blkIndent, !0), !0; } export { h as default }; //# sourceMappingURL=html_block.mjs.map