PrismJS doesn't detect/highlight properly JSX
See original GitHub issueInformation
- Language: [JavaScript-React]
- Plugins (configs):
"plugins": [
[
"prismjs",
{
"languages": [
"jsx",
"css",
"html"
],
"plugins": [
"show-language",
"keep-markup"
],
"theme": "okaidia",
"css": true
}
],
[
"styled-components",
{
"ssr": true,
"displayName": true
}
]
]

Does the problem still occur in the latest version of Prism? You can check using the test page or get the latest version at the download page. Yes
Description The JSX markup is not working.
Code snippet
The code being highlighted incorrectly (doesn't detect JSX).
"languages": [
// I have also tried adding/removing "javascript" from this array
"jsx",
"css",
"html"
],
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Prismjs not highlighting for React component - Stack Overflow
I tried your Editor component code and it worked for me. One thing I noticed is that you're not using the props.language object...
Read more >FAQ - Prism.js
Isn't it bad to do syntax highlighting with regular expressions? It is true that to correctly handle every possible case of syntax found...
Read more >Code samples with line highlighting · How to build
In this step-by-step guide I show how to build a React component ... (It doesn't help either that the library is called highlight.js...
Read more >How to use Prism.js correctly with Frontity - #28 by Divaksh
Code doesn't get highlighted on first visit to post from the home page. · Code gets highlighted if I go back to the...
Read more >prism-react-renderer - Best of JS
prism-react-renderer 🖌️. A lean Prism highlighter component for React Comes with everything to render Prismjs highlighted code directly to React (Native) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ohh shocks!! what a goof! 😄 I tried changing back and forth in both - in languages, .babelrc, and in the element markup, but looks like I changed back the markup at one point, lol.
Thanks so much @RunDevelopment !!! this solved!
Judging from the screenshot in #2260, it seems I’m correct.