Code Monkey home page Code Monkey logo

Comments (7)

arno-le avatar arno-le commented on May 18, 2024 3

A workaround for now is to set

window.Prism = window.Prism || {};
Prism.manual = true;

at an early stage.
PrismJS documentation regarding the manual property.

Suggested by a maintainer in PrismJS/prism#3066 (comment)
to stop Prism from re-highlighting the code.

from redocusaurus.

drichards-87 avatar drichards-87 commented on May 18, 2024 1

I appreciate it. I did notice this same issue occurring on another site that uses Redocusaurus: https://docs.spectacles.dev/app/tutorials/getting-started/

If you expand Reference in the left TOC and hover over API, the code block on the page collapses into a single line. (You may have to refresh the page in order to reproduce - it doesn't always happen consistently.)

from redocusaurus.

arno-le avatar arno-le commented on May 18, 2024 1

I can reproduce the issue using the example content in this repository by adding a navbar / sidebar link to an API documentation page.

As an optimization measure on link hover, Docusaurus loads http://localhost:3000/vendors-node_modules_redoc_bundles_redoc_lib_js.js, which includes its own copy of PrismJS. This seems to interfere with the existing PrismJS bundled by Docusaurus, causing the render output to break.

from redocusaurus.

arno-le avatar arno-le commented on May 18, 2024 1

The natural place would be somewhere in index.html, but as that's kinda hard to reach, I'm setting it in a swizzled <Layout/> component... And I don't know if this plugin should inject that to avoid other problems that might come up.

Maybe an issue could be raised in the Docusaurus repo to continue the discussion there first, as this is a fairly popular plugin, after all.

from redocusaurus.

rohit-gohri avatar rohit-gohri commented on May 18, 2024

I don't think this could be because of redoc, but I'll try to reproduce in my repo.

from redocusaurus.

drichards-87 avatar drichards-87 commented on May 18, 2024

@ygerg Do you have any guidance as to where/how to set this in our Docusaurus sites?

from redocusaurus.

rohit-gohri avatar rohit-gohri commented on May 18, 2024

And I don't know if this plugin should inject that to avoid other problems that might come up.

I would be open to add it behind a flag in the config. Could add it here: https://github.com/rohit-gohri/redocusaurus/blob/main/packages/docusaurus-theme-redoc/src/redocTheme.ts so it gets loaded before we load redoc. I think it would work.

If anyone wants to open a PR, feel free.

from redocusaurus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.