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-bqn.min.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 public/prism/prism-bqn.min.js (limited to 'public/prism/prism-bqn.min.js') diff --git a/public/prism/prism-bqn.min.js b/public/prism/prism-bqn.min.js new file mode 100644 index 0000000..b28eb95 --- /dev/null +++ b/public/prism/prism-bqn.min.js @@ -0,0 +1,41 @@ +Prism.languages.bqn = { + shebang: { pattern: /^#![ \t]*\/.*/, alias: 'important', greedy: !0 }, + comment: { pattern: /#.*/, greedy: !0 }, + 'string-literal': { pattern: /"(?:[^"]|"")*"/, greedy: !0, alias: 'string' }, + 'character-literal': { + pattern: /'(?:[\s\S]|[\uD800-\uDBFF][\uDC00-\uDFFF])'/, + greedy: !0, + alias: 'char', + }, + function: /•[\w¯.∞π]+[\w¯.∞π]*/, + 'dot-notation-on-brackets': { + pattern: /\{(?=.*\}\.)|\}\./, + alias: 'namespace', + }, + 'special-name': { + pattern: /(?:𝕨|𝕩|𝕗|𝕘|𝕤|𝕣|𝕎|𝕏|𝔽|𝔾|𝕊|_𝕣_|_𝕣)/, + alias: 'keyword', + }, + 'dot-notation-on-name': { + pattern: /[A-Za-z_][\w¯∞π]*\./, + alias: 'namespace', + }, + 'word-number-scientific': { + pattern: /\d+(?:\.\d+)?[eE]¯?\d+/, + alias: 'number', + }, + 'word-name': { pattern: /[A-Za-z_][\w¯∞π]*/, alias: 'symbol' }, + 'word-number': { + pattern: + /[¯∞π]?(?:\d*\.?\b\d+(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π))?/, + alias: 'number', + }, + 'null-literal': { pattern: /@/, alias: 'char' }, + 'primitive-functions': { + pattern: /[-+×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!]/, + alias: 'operator', + }, + 'primitive-1-operators': { pattern: /[`˜˘¨⁼⌜´˝˙]/, alias: 'operator' }, + 'primitive-2-operators': { pattern: /[∘⊸⟜○⌾⎉⚇⍟⊘◶⎊]/, alias: 'operator' }, + punctuation: /[←⇐↩(){}⟨⟩[\]‿·⋄,.;:?]/, +}; -- cgit v1.2.3