From 006b15b467a5cd835a6eab1b49023100bdc8f2e6 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 13 Oct 2023 19:32:56 +0200 Subject: refactor(components): rewrite Code component and usePrism hook * move Prism styles to Sass placeholders to avoid repeats * let usePrism consumer define its plugins (remove default ones) * remove `plugins` prop from Code component * add new props to Code component to let consumer configure plugins (and handle plugin list from the given options) However there are some problems with Prism plugins: line-highlight and treeview does not seems to be loaded. I don't want to use Babel instead of SWC so I have no solution for now. --- public/prism/prism-javadoclike.min.js | 56 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'public/prism/prism-javadoclike.min.js') diff --git a/public/prism/prism-javadoclike.min.js b/public/prism/prism-javadoclike.min.js index 782f3f1..0477366 100644 --- a/public/prism/prism-javadoclike.min.js +++ b/public/prism/prism-javadoclike.min.js @@ -1,5 +1,5 @@ -!(function (p) { - var a = (p.languages.javadoclike = { +!(function (a) { + var e = (a.languages.javadoclike = { parameter: { pattern: /(^[\t ]*(?:\/{3}|\*|\/\*\*)\s*@(?:arg|arguments|param)\s+)\w+/m, lookbehind: !0, @@ -10,38 +10,36 @@ }, punctuation: /[{}]/, }); - Object.defineProperty(a, 'addSupport', { - value: function (a, e) { - 'string' == typeof a && (a = [a]), - a.forEach(function (a) { - !(function (a, e) { - var n = 'doc-comment', - t = p.languages[a]; - if (t) { - var r = t[n]; - if (!r) { - var o = { - 'doc-comment': { - pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/, - lookbehind: !0, - alias: 'comment', - }, - }; - r = (t = p.languages.insertBefore(a, 'comment', o))[n]; - } + Object.defineProperty(e, 'addSupport', { + value: function (e, n) { + 'string' == typeof e && (e = [e]), + e.forEach(function (e) { + !(function (e, n) { + var t = 'doc-comment', + r = a.languages[e]; + if (r) { + var o = r[t]; if ( - (r instanceof RegExp && (r = t[n] = { pattern: r }), - Array.isArray(r)) + (o || + (o = (r = a.languages.insertBefore(e, 'comment', { + 'doc-comment': { + pattern: /(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/, + lookbehind: !0, + alias: 'comment', + }, + }))[t]), + o instanceof RegExp && (o = r[t] = { pattern: o }), + Array.isArray(o)) ) - for (var i = 0, s = r.length; i < s; i++) - r[i] instanceof RegExp && (r[i] = { pattern: r[i] }), e(r[i]); - else e(r); + for (var i = 0, s = o.length; i < s; i++) + o[i] instanceof RegExp && (o[i] = { pattern: o[i] }), n(o[i]); + else n(o); } - })(a, function (a) { - a.inside || (a.inside = {}), (a.inside.rest = e); + })(e, function (a) { + a.inside || (a.inside = {}), (a.inside.rest = n); }); }); }, }), - a.addSupport(['java', 'javascript', 'php'], a); + e.addSupport(['java', 'javascript', 'php'], e); })(Prism); -- cgit v1.2.3