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
withinthemeConfig
addprism: { 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:
- Created 3 years ago
- Comments:11 (4 by maintainers)
Top 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 >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 FreeTop 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
Top GitHub Comments
For anyone having a similar problem.
Here’s how to fix it for the
sparql
language:cat node_modules/prismjs/components/prism-sparql.js
Prism.languages.extend('turtle'
in source codeadditionalLanguages: ['turtle', 'sparql']
The process should be similar to any language requiring extensions
Fix for
scala
: