aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-scala.min.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-13 19:32:56 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit006b15b467a5cd835a6eab1b49023100bdc8f2e6 (patch)
tree949c7295c2e206f42357f135bab4696ddf6576ec /public/prism/prism-scala.min.js
parent00f147a7a687d5772bcc538bc606cfff972178cd (diff)
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.
Diffstat (limited to 'public/prism/prism-scala.min.js')
-rw-r--r--public/prism/prism-scala.min.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/public/prism/prism-scala.min.js b/public/prism/prism-scala.min.js
index 93a02ba..fcc44b9 100644
--- a/public/prism/prism-scala.min.js
+++ b/public/prism/prism-scala.min.js
@@ -6,12 +6,33 @@
},
string: { pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, greedy: !0 },
keyword:
- /<-|=>|\b(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|self|super|this|throw|trait|try|type|val|var|while|with|yield)\b/,
+ /<-|=>|\b(?:abstract|case|catch|class|def|derives|do|else|enum|extends|extension|final|finally|for|forSome|given|if|implicit|import|infix|inline|lazy|match|new|null|object|opaque|open|override|package|private|protected|return|sealed|self|super|this|throw|trait|transparent|try|type|using|val|var|while|with|yield)\b/,
number:
/\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,
builtin:
/\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
symbol: /'[^\d\s\\]\w*/,
})),
+ Prism.languages.insertBefore('scala', 'triple-quoted-string', {
+ 'string-interpolation': {
+ pattern:
+ /\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
+ greedy: !0,
+ inside: {
+ id: { pattern: /^\w+/, greedy: !0, alias: 'function' },
+ escape: { pattern: /\\\$"|\$[$"]/, greedy: !0, alias: 'symbol' },
+ interpolation: {
+ pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
+ greedy: !0,
+ inside: {
+ punctuation: /^\$\{?|\}$/,
+ expression: { pattern: /[\s\S]+/, inside: Prism.languages.scala },
+ },
+ },
+ string: /[\s\S]+/,
+ },
+ },
+ }),
delete Prism.languages.scala['class-name'],
- delete Prism.languages.scala.function;
+ delete Prism.languages.scala.function,
+ delete Prism.languages.scala.constant;