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.

prism.additionalLanguages broken in v2

See original GitHub issue

🐛 Bug Report

themeConfig.prism.additionalLanguages seems to be broken in the most recent v2 alpha.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  • Create a new docusaurus app using 2.0.0-alpha.50.
  • In docusaurus.config.js within themeConfig add
    prism: {
      additionalLanguages: [ 'crystal' ] // Or any language
    }
    
  • Run npm start

Expected behavior

Things should build correctly and syntax highlighting should work with the requested language

Actual Behavior

The following error is shown in the teminal:

TypeError: Cannot read property 'originalSource' of undefined
    at getSourceById (/home/username/projectname/node_modules/react-dev-utils/evalSourceMapMiddleware.js:18:17)
    at handleWebpackInternalMiddleware (/home/username/projectname/node_modules/react-dev-utils/evalSourceMapMiddleware.js:37:22)
    at Layer.handle [as handle_request] (/home/username/projectname/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/username/projectname/node_modules/express/lib/router/index.js:317:13)
    at /home/username/projectname/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/username/projectname/node_modules/express/lib/router/index.js:335:12)
    at next (/home/username/projectname/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/home/username/projectname/node_modules/serve-static/index.js:121:7)
    at SendStream.emit (events.js:315:20)
    at SendStream.error (/home/username/projectname/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/home/username/projectname/node_modules/send/index.js:421:12)
    at next (/home/username/projectname/node_modules/send/index.js:735:16)
    at onstat (/home/username/projectname/node_modules/send/index.js:724:14)
    at FSReqCallback.oncomplete (fs.js:171:21)

Your Environment

  • Docusaurus version used: 2.0.0-alpha.50
  • Environment name and version :
    • Mozilla Firefox 74.0.1
    • NodeJS v13.12.0 (also tried with 12, 11, and 10)
  • Operating system and version (desktop or mobile): Arch Linux 5.5.13-arch2-1

Reproducible Demo

https://github.com/watzon/dousaurus-testapp

Literally a brand new app with the aforementioned section added to the config.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
slorbercommented, Aug 26, 2021

For anyone having a similar problem.

Here’s how to fix it for the sparql language:

  • run cat node_modules/prismjs/components/prism-sparql.js
  • see Prism.languages.extend('turtle' in source code
  • use additionalLanguages: ['turtle', 'sparql']

The process should be similar to any language requiring extensions

1reaction
afshinmcommented, Dec 14, 2021

Fix for scala:

     prism: {
       additionalLanguages: ['java', 'scala'],
     },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Prism
Extensible Define new languages or extend existing ones. Add new features thanks to Prism's plugin architecture. Easy styling All styling is done through...
Read more >
Code blocks | Docusaurus
For example, Prism would map the language cs to csharp , but only prism-csharp.js exists as a component, so you need to use...
Read more >
@docusaurus/utils-validation | Yarn - Package Manager
We are working hard on Docusaurus v2. If you are new to Docusaurus, try using the new version instead of v1. See the...
Read more >
Code Sample plugin | Docs - TinyMCE
js version bundled inside the codesample plugin. This allows for a custom version of Prism.js, including additional languages, to be used. When using...
Read more >
SECPASS | BRL-CAD Documentations
Which release of PRISM is being used, 2.0 (2) or 3.0 (3)? 3. Which length calculation should be used when computing conduction between...
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