Skip to content

Commit

Permalink
Fix tags inside jsx spread
Browse files Browse the repository at this point in the history
  • Loading branch information
FIameCaster committed Jan 5, 2024
1 parent edcc167 commit 9ec5299
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions package/patches/prismjs@1.29.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5375,10 +5375,10 @@ index 690fe7b56df7a59546bd030640287e915dee53ee..8dd362caf312bbf698e8e74d6a16e30d
},

diff --git a/components/prism-jsx.js b/components/prism-jsx.js
index ac6c2d64243ac329e7c8a159cdebf5b37eff6a4e..a9c9125a350586188b74150c63734086c604f289 100644
index ac6c2d64243ac329e7c8a159cdebf5b37eff6a4e..11b79cee936c3dcaf92e06dbb25bd7a06e5b7048 100644
--- a/components/prism-jsx.js
+++ b/components/prism-jsx.js
@@ -1,145 +1,128 @@
@@ -1,145 +1,127 @@
(function (Prism) {

- var javascript = Prism.util.clone(Prism.languages.javascript);
Expand All @@ -5394,8 +5394,9 @@ index ac6c2d64243ac329e7c8a159cdebf5b37eff6a4e..a9c9125a350586188b74150c63734086
+ var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/;

/**
* @param {string} source
* @param {string} [flags]
- * @param {string} source
- * @param {string} [flags]
+ * @param {RegExp} pattern
*/
- function re(source, flags) {
- source = source
Expand Down Expand Up @@ -5434,7 +5435,8 @@ index ac6c2d64243ac329e7c8a159cdebf5b37eff6a4e..a9c9125a350586188b74150c63734086
+ delete jsx.script;
+ delete jsx['markup-bracket'];

Prism.languages.insertBefore('inside', 'attr-name', {
- Prism.languages.insertBefore('inside', 'attr-name', {
+ Prism.languages.insertBefore('inside', 'punctuation', {
'spread': {
- pattern: re(/<SPREAD>/.source),
- inside: Prism.languages.jsx
Expand All @@ -5449,7 +5451,7 @@ index ac6c2d64243ac329e7c8a159cdebf5b37eff6a4e..a9c9125a350586188b74150c63734086
// Allow for two levels of nesting
- pattern: re(/=<BRACES>/.source),
- alias: 'language-javascript',
+ pattern: re(/=<BRACES>/),
+ pattern: re(/=\s*<BRACES>/),
+ alias: 'language-jsx',
inside: {
'script-punctuation': {
Expand Down
6 changes: 3 additions & 3 deletions package/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ec5299

Please sign in to comment.