Syntax highlighting fails and breaks the formatting when hovering over nav
See original GitHub issue🐛 Bug Report
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io
- I have read the console error message carefully (if applicable)
Description
The highlighting and formatting of code blocks breaks when I hover over the top right menu items.

This happens on all pages containing a code block.
Demo: https://docs.talon.one/docs/dev/getting-started/overview/
The console doesn’t report any error.
Have you read the Contributing Guidelines on issues?
yes
Steps to reproduce
- Go on a page that contains a code block.
- hover over the top right menu items.
Expected behavior
The code blocks remain the same.
Actual behavior
Hovering over the menu breaks the codeblocks.
Your environment
- Public source code: No but I can share whatever you need.
- Public site URL: https://docs.talon.one/docs/dev/getting-started/overview/
- Docusaurus version used: 2.0.0-beta.5
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): tested on Firefox and Brave
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): -
Package.json dependencies
"dependencies": {
"@docusaurus/core": "^2.0.0-beta.5",
"@docusaurus/preset-classic": "^2.0.0-beta.5",
"@docusaurus/theme-search-algolia": "^2.0.0-beta.5",
"@mdx-js/react": "^1.6.22",
"@svgr/webpack": "^5.5.0",
"antd": "^4.9.4",
"clsx": "^1.1.1",
"core-js": "^3.8.1",
"docusaurus-gtm-plugin": "^0.0.2",
"docusaurus-plugin-sass": "^0.1.14",
"file-loader": "^6.2.0",
"https-browserify": "^1.0.0",
"mobx": "^6.0.4",
"path-browserify": "^1.0.1",
"prism-react-renderer": "^1.2.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"redoc": "^2.0.0-rc.48",
"redocusaurus": "^0.4.5",
"sass": "^1.32.13",
"styled-components": "^5.2.1",
"url-loader": "^4.1.1"
},
Let me know if you need extra information.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14 (1 by maintainers)
Top Results From Across the Web
hover - CSS: Cascading Style Sheets - MDN Web Docs
It is generally triggered when the user hovers over an element with the cursor (mouse pointer).
Read more >Nav menu not displaying drop down and causing format ...
About the problem; the breaking was caused because you weren't using the .sub-menu-2 inside it's parent li . I've fixed it, and added...
Read more >CSS, SCSS, and Less support in Visual Studio Code
Hovering over a selector or property will provide an HTML snippet that is matched by the CSS rule. Hover in CSS. Go to...
Read more >Hover text and formatting in Python - Plotly
Over 17 examples of Hover Text and Formatting including changing color, size, log axes, and more in Python.
Read more >Highlighting | Elasticsearch Guide [8.5] | Elastic
This highlighter breaks the text into sentences and uses the BM25 ... when highlighting a Boosting Query that boosts phrase matches over term...
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

@ArthurFlageul it’s quite hard to debug given the customizations you’ve made and the unavailability of source code. I would conclude that redocusaurus is breaking your site because it does do magic on client side.
Following the discussion in https://github.com/rohit-gohri/redocusaurus/issues/89 and https://github.com/PrismJS/prism/issues/3066 I think they are right: it has something to do with redocusaurus remounting / reparsing code blocks client-side. I would inspect if
Prism.manualis a good fix.in my opinion main problem lays down in prism react plugin, in current (as is) implementation, styles are injected at runtime instead using css for it,
what do you guys think about removing runtime from it completely? and use css for colors?
that could fix some additional issues with highligting not working without js css file: https://cdnjs.cloudflare.com/ajax/libs/prism/1.25.0/themes/prism-dark.css
this task is going to require us to process this file / import it conditionally on user config to add support for dark/light theme, but that shouldn’t be a big issue
this is just an idea:
prism-react-renderer seem a little outdated and not maintained, maybe we could change it to use refractor if we need it at runtime react-syntax-highlighter if we don’t need it at runtime @mapbox/rehype-prism