prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
19 lines (18 loc) • 708 B
JavaScript
import { l as m } from "../index-fa58cb3b.js";
import { i as r, x as g, a } from "../patterns-9129a01c.js";
import "../prismCore-5c7f03d0.js";
const e = /^(area|base|w?br|col|embed|hr|img|input|link|meta|source|track)$/, o = (s) => !e.test(s.match(a)?.[1] || "br");
m.markup = m.html = m.markdown = m.md = {
comments: {
block: ["<!--", "-->"]
},
autoIndent: [
([s], t) => o(t = t.substring(s - 999, s)) || /[([{][^\n)\]}]*$/.test(t),
([s, t], i) => r.test(i[s - 1] + i[t]) || o(i.substring(s - 999, s)) && g.test(i.slice(t))
],
autoCloseTags([s, t], i) {
const n = s == t ? (i.substring(s - 999, s) + ">").match(a)?.[1] : "";
if (n && !e.test(n))
return `</${n}>`;
}
};