question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gatsby-remark-prismjs line highlight breaks when react-live is included

See original GitHub issue

I recently noticed a bug with the gatsby-remark-prismjs plugin on a site I’m working on: code line-highlights show up when I navigate to a page initially, but if I reload the page in place they’re missing. (There’s no wrapper <span class="gatsby-highlight-code-line">...</span> after a page reload).

After a lot of trimming down, I’ve been able to demonstrate this bug in a small repro (at bvaughn/gatsby-remark-prismjs-react-live-bug). The tl;dr is that including any react-live component (even if it’s not used) will break the gatsby-remark-prismjs plugin line highlight.

I will attempt to further track this issue down. I’m also unclear about whether I should file this as an issue for Gatsby or React Live, but I suspect it’s most likely something that should be fixed in React Live.

Relates to gatsbyjs/gatsby/issues/1486

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bvaughncommented, Jul 13, 2017

Thank you!

Yes, it’s an ongoing effort. 😄

1reaction
bvaughncommented, Jul 12, 2017

Looks like maybe this can be avoided by removing the language attribute from Gatsby’s pre-generated <pre> tags. This way, requiring Prism a second time won’t re-highlight the already-processed content.

At this point, this is clearly not an issue with react-live so I’m going to close this out. Thanks for your input!

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-remark-prismjs line highlight breaks when react-live is ...
I recently noticed a bug with the gatsby-remark-prismjs plugin on a site I'm working on: code line-highlights show up when I navigate to...
Read more >
gatsby-remark-prismjs
gatsby -remark-prismjs Adds syntax highlighting to code blocks in markdown files using PrismJS. Install How to use Include CSS Required…
Read more >
Improving Prism diff syntax highlighting in Gatsby
I'm doing it to avoid breaking the blog post if I update my syntax highlighting strategy in the future. Highlighting diff lines. Prism...
Read more >
Trouble formating <pre> using Prism in Gatsby - Prismic People
I'm having trouble getting Prism working with the Remark transformer in Gatsby as described here: The issue seems to be that Prism works...
Read more >
gatsby-remark-prismjs is not working on html - Stack Overflow
I'm trying to highlighting codes like javascript and swift. My blog contents fetched from wordpress.com. enter image description here. Here is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found