CSS in JS syntax highlight is broken on Prism
See original GitHub issueDescribe the bug
I try to highlight styled-components code with function, code got unexpected.
To Reproduce Steps to reproduce the behavior:
- append like those code
const Item = styled.div`
grid-row: ${({ row }) => row};
grid-columns: ${ ({ col }) => col};
`
- wrap with Prism syntax highligter
<SyntaxHighlighter language={"js"} style={prismStyle}>
{code}
</SyntaxHighlighter>
- got unexpected code
const Item = styled.div`
grid-row: ___CSS_0___;
grid-columns: ___CSS_1___;
`
Expected behavior I want to get like higlight.js version result.
const Item = styled.div`
grid-row: ${({ row }) => row};
grid-columns: ${ ({ col }) => col};
`
Screenshots https://stackblitz.com/edit/react-tjouhm

Desktop (please complete the following information):
- OS: Mac
- Browser chrome,
- Version: 77.0.3865.120
Smartphone (please complete the following information):
- Device: iPhone6 SE
- OS: iOS 13.1.3
- Browser chrome
- Version 78
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
PrismJS syntax highlighting is broken due to conflicts with Bulma
There are at least 2 workarounds. Workaround #1. PrismJS adds token class to all highlighted elements including number and tag unlike Bulma.
Read more >Syntax highlighting working only on first occasion #1301
I am using PrismJS on my website for code blocks. Issue is, on Chrome on Windows 7, Syntax highlighting and line numbering working...
Read more >Syntax Highlighting (and More!) With Prism on a Static Site
This post will show you how to implement syntax highlighting on a Next.js blog with the popular Prism.js library.
Read more >Solved: Re: RoboHelp 2020 > Frameless > Syntax Highlighter...
I'm using Prism.JS (https://prismjs.com/) to generate syntax highlighting for XML markup in the docs I'm writing. Locally, this all works well and looks ......
Read more >Prism.js
Dead simple Include prism.css and prism.js, use proper HTML5 code tags ... The Prism source, highlighted with Prism (don't you just love how...
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
Hey @jack-bliss, I’ll try to take a look at this soon! Thanks for your patience.
any word on this? I love that prism is highlighting my css in js rather than just leaving it as a string. it’s not blocking for me because i’m happy to just tweak my examples, but it’s definitely limiting and could become annoying down the road.