mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 03:42:14 +00:00
[Beta] Highlight <Foo> and <foo> differently (#5368)
This commit is contained in:
15
beta/patches/@codemirror+lang-javascript+0.19.6.patch
Normal file
15
beta/patches/@codemirror+lang-javascript+0.19.6.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
diff --git a/node_modules/@codemirror/lang-javascript/dist/index.js b/node_modules/@codemirror/lang-javascript/dist/index.js
|
||||
index d089f6b..db09ea6 100644
|
||||
--- a/node_modules/@codemirror/lang-javascript/dist/index.js
|
||||
+++ b/node_modules/@codemirror/lang-javascript/dist/index.js
|
||||
@@ -131,7 +131,9 @@ const javascriptLanguage = /*@__PURE__*/LRLanguage.define({
|
||||
JSXText: tags.content,
|
||||
"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": tags.angleBracket,
|
||||
"JSXIdentifier JSXNameSpacedName": tags.tagName,
|
||||
- "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName
|
||||
+ "JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName,
|
||||
+ "JSXAttribute/JSXLowerIdentifier JSXAttribute/JSXNameSpacedName": tags.attributeName,
|
||||
+ "JSXBuiltin/JSXIdentifier": tags.standard(tags.tagName),
|
||||
})
|
||||
]
|
||||
}),
|
||||
26
beta/patches/@codesandbox+sandpack-react+1.15.5.patch
Normal file
26
beta/patches/@codesandbox+sandpack-react+1.15.5.patch
Normal file
File diff suppressed because one or more lines are too long
345
beta/patches/@lezer+javascript+0.15.2.patch
Normal file
345
beta/patches/@lezer+javascript+0.15.2.patch
Normal file
File diff suppressed because one or more lines are too long
@@ -3,11 +3,10 @@
|
||||
*/
|
||||
|
||||
import cn from 'classnames';
|
||||
import {highlightTree} from '@codemirror/highlight';
|
||||
import {highlightTree, HighlightStyle, tags} from '@codemirror/highlight';
|
||||
import {javascript} from '@codemirror/lang-javascript';
|
||||
import {html} from '@codemirror/lang-html';
|
||||
import {css} from '@codemirror/lang-css';
|
||||
import {HighlightStyle, tags} from '@codemirror/highlight';
|
||||
import rangeParser from 'parse-numeric-range';
|
||||
import {CustomTheme} from '../Sandpack/Themes';
|
||||
|
||||
@@ -233,7 +232,7 @@ function getSyntaxHighlight(theme: any): HighlightStyle {
|
||||
class: classNameToken('static'),
|
||||
},
|
||||
{
|
||||
tag: tags.tagName,
|
||||
tag: tags.standard(tags.tagName),
|
||||
class: classNameToken('tag'),
|
||||
},
|
||||
{tag: tags.variableName, class: classNameToken('plain')},
|
||||
@@ -244,7 +243,7 @@ function getSyntaxHighlight(theme: any): HighlightStyle {
|
||||
},
|
||||
{
|
||||
// Highlight function definition differently (eg: functional component def in React)
|
||||
tag: tags.definition(tags.function(tags.variableName)),
|
||||
tag: [tags.definition(tags.function(tags.variableName)), tags.tagName],
|
||||
class: classNameToken('definition'),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user