summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-js-templates.min.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2021-12-30 19:47:21 +0100
committerArmand Philippot <git@armandphilippot.com>2021-12-30 19:47:21 +0100
commita98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 (patch)
tree542810ab5aef99150db228bb54fd58303dcb31c7 /public/prism/prism-js-templates.min.js
parentab355897a12b7bda1089a44de326d41455a0f7a3 (diff)
chore: add prismjs for syntax highlighting
Diffstat (limited to 'public/prism/prism-js-templates.min.js')
-rw-r--r--public/prism/prism-js-templates.min.js146
1 files changed, 146 insertions, 0 deletions
diff --git a/public/prism/prism-js-templates.min.js b/public/prism/prism-js-templates.min.js
new file mode 100644
index 0000000..c3171c1
--- /dev/null
+++ b/public/prism/prism-js-templates.min.js
@@ -0,0 +1,146 @@
+!(function (u) {
+ var e = u.languages.javascript['template-string'],
+ n = e.pattern.source,
+ a = e.inside.interpolation,
+ i = a.inside['interpolation-punctuation'],
+ r = a.pattern.source;
+ function t(e, t) {
+ if (u.languages[e])
+ return {
+ pattern: RegExp('((?:' + t + ')\\s*)' + n),
+ lookbehind: !0,
+ greedy: !0,
+ inside: {
+ 'template-punctuation': { pattern: /^`|`$/, alias: 'string' },
+ 'embedded-code': { pattern: /[\s\S]+/, alias: e },
+ },
+ };
+ }
+ function s(e, t, n) {
+ var r = { code: e, grammar: t, language: n };
+ return (
+ u.hooks.run('before-tokenize', r),
+ (r.tokens = u.tokenize(r.code, r.grammar)),
+ u.hooks.run('after-tokenize', r),
+ r.tokens
+ );
+ }
+ function d(e) {
+ var t = {};
+ t['interpolation-punctuation'] = i;
+ var n = u.tokenize(e, t);
+ if (3 === n.length) {
+ var r = [1, 1];
+ r.push.apply(r, s(n[1], u.languages.javascript, 'javascript')),
+ n.splice.apply(n, r);
+ }
+ return new u.Token('interpolation', n, a.alias, e);
+ }
+ function c(a, e, i) {
+ var t = u.tokenize(a, {
+ interpolation: { pattern: RegExp(r), lookbehind: !0 },
+ }),
+ f = 0,
+ y = {},
+ n = s(
+ t
+ .map(function (e) {
+ if ('string' == typeof e) return e;
+ for (
+ var t, n = e.content;
+ -1 !==
+ a.indexOf(
+ ((r = f++), (t = '___' + i.toUpperCase() + '_' + r + '___'))
+ );
+
+ );
+ return (y[t] = n), t;
+ var r;
+ })
+ .join(''),
+ e,
+ i
+ ),
+ v = Object.keys(y);
+ return (
+ (f = 0),
+ (function e(t) {
+ for (var n = 0; n < t.length; n++) {
+ if (f >= v.length) return;
+ var r = t[n];
+ if ('string' == typeof r || 'string' == typeof r.content) {
+ var a = v[f],
+ i = 'string' == typeof r ? r : r.content,
+ s = i.indexOf(a);
+ if (-1 !== s) {
+ ++f;
+ var o = i.substring(0, s),
+ p = d(y[a]),
+ l = i.substring(s + a.length),
+ g = [];
+ if ((o && g.push(o), g.push(p), l)) {
+ var u = [l];
+ e(u), g.push.apply(g, u);
+ }
+ 'string' == typeof r
+ ? (t.splice.apply(t, [n, 1].concat(g)), (n += g.length - 1))
+ : (r.content = g);
+ }
+ } else {
+ var c = r.content;
+ Array.isArray(c) ? e(c) : e([c]);
+ }
+ }
+ })(n),
+ new u.Token(i, n, 'language-' + i, a)
+ );
+ }
+ u.languages.javascript['template-string'] = [
+ t(
+ 'css',
+ '\\b(?:styled(?:\\([^)]*\\))?(?:\\s*\\.\\s*\\w+(?:\\([^)]*\\))*)*|css(?:\\s*\\.\\s*(?:global|resolve))?|createGlobalStyle|keyframes)'
+ ),
+ t('html', '\\bhtml|\\.\\s*(?:inner|outer)HTML\\s*\\+?='),
+ t('svg', '\\bsvg'),
+ t('markdown', '\\b(?:markdown|md)'),
+ t('graphql', '\\b(?:gql|graphql(?:\\s*\\.\\s*experimental)?)'),
+ t('sql', '\\bsql'),
+ e,
+ ].filter(Boolean);
+ var o = { javascript: !0, js: !0, typescript: !0, ts: !0, jsx: !0, tsx: !0 };
+ function f(e) {
+ return 'string' == typeof e
+ ? e
+ : Array.isArray(e)
+ ? e.map(f).join('')
+ : f(e.content);
+ }
+ u.hooks.add('after-tokenize', function (e) {
+ e.language in o &&
+ !(function e(t) {
+ for (var n = 0, r = t.length; n < r; n++) {
+ var a = t[n];
+ if ('string' != typeof a) {
+ var i = a.content;
+ if (Array.isArray(i))
+ if ('template-string' === a.type) {
+ var s = i[1];
+ if (
+ 3 === i.length &&
+ 'string' != typeof s &&
+ 'embedded-code' === s.type
+ ) {
+ var o = f(s),
+ p = s.alias,
+ l = Array.isArray(p) ? p[0] : p,
+ g = u.languages[l];
+ if (!g) continue;
+ i[1] = c(o, g, l);
+ }
+ } else e(i);
+ else 'string' != typeof i && e([i]);
+ }
+ }
+ })(e.tokens);
+ });
+})(Prism);