Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling additional languages for syntax highlighting in Docusaurus breaks Redocusaurus #68

Closed
inacho opened this issue Jul 8, 2021 · 3 comments
Labels
bug Something isn't working integration

Comments

@inacho
Copy link

inacho commented Jul 8, 2021

How to reproduce

Add additional languages for the syntax highlighting in Docusarus (https://docusaurus.io/docs/markdown-features/code-blocks#supported-languages)

Example:

module.exports = {
  // ...
  themeConfig: {
    prism: {
      additionalLanguages: ['java'],
    },
    // ...
  },
};

The additional language is correctly enabled in Docusaurus, however, when navigating to a Redocusaurus page the following error is happening:

Uncaught (in promise) TypeError: lang is undefined

Screen Shot 2021-07-08 at 13 00 42

Dependencies used in package.json

"dependencies": {
    "@docusaurus/core": "2.0.0-beta.3",
    "@docusaurus/preset-classic": "2.0.0-beta.3",
    "@mdx-js/react": "^1.6.22",
    "@svgr/webpack": "^5.5.0",
    "clsx": "^1.1.1",
    "core-js": "^3.9.1",
    "docusaurus-theme-redoc": "^0.4.4",
    "file-loader": "^6.2.0",
    "prism-react-renderer": "^1.2.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "redoc": "^2.0.0-rc.54",
    "redocusaurus": "^0.4.4",
    "remark-mermaid-dataurl": "^1.0.1",
    "url-loader": "^4.1.1"
  },

Any idea of how to fix it?
Thanks

@rohit-gohri
Copy link
Owner

Redoc also ships prism with itself, the global configs might be conflicting.

@rohit-gohri rohit-gohri added bug Something isn't working integration labels Jul 8, 2021
@inacho
Copy link
Author

inacho commented Jul 12, 2021

I noticed that the problem disappear if I add the language "scala" on top of "java":

module.exports = {
  // ...
  themeConfig: {
    prism: {
      additionalLanguages: ['java', 'scala'],
    },
    // ...
  },
};

As you said, this is probably due to conflicts with prism in Redoc.
I guess Redoc expects to have Scala enabled.
Feel free to close the bug.

Thanks

@rohit-gohri
Copy link
Owner

Thanks for posting the solution 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integration
Projects
None yet
Development

No branches or pull requests

2 participants