Closed watzon closed 4 years ago
I cannot reproduce with similar errors, but Crystal syntax highlighting really will not work like that, because you still need to include Ruby, because Crystal extends it's syntax (this is done in Prism)
- additionalLanguages: ['crystal'],
+ additionalLanguages: ['ruby', 'crystal'],
@lex111 I tried that as well. I still get the same error in the terminal, and in the browser console I get Error: Cannot find module './prism-ruby'
.
Weird. It works when I deploy to zeit, just not locally. So it has to be a system issue.
Ok well I got it working locally. I was using asdf to version node, so I uninstalled the asdf node plugin and installed node using my system package manager. Now things work.
I am having a similar issue when trying to add 'sparql'
to the additionalLanguages
array. Below is the error I am receiving:
Any advice would be greatly appreciated.
Uncaught TypeError: Cannot set property 'boolean' of undefined
at Object.extend (index.js?4953:86)
at eval (prism-sparql.js?7063:1)
at Object../node_modules/prismjs/components/prism-sparql.js (main.js:362)
at __webpack_require__ (runtime~main.js:36)
at fn (runtime~main.js:340)
at webpackContext (main.js:377)
at eval (prism-include-languages.js?fcbd:6)
at Array.forEach (<anonymous>)
at prismIncludeLanguages (prism-include-languages.js?fcbd:6)
at eval (prism-include-languages.js?67c1:6)
at Module../node_modules/@docusaurus/theme-classic/lib/prism-include-languages.js (main.js:237)
at __webpack_require__ (runtime~main.js:36)
at fn (runtime~main.js:340)
at eval (client-modules.js?5edc:1)
at Module../.docusaurus/client-modules.js (main.js:23)
at __webpack_require__ (runtime~main.js:36)
at fn (runtime~main.js:340)
at eval (client-lifecycles-dispatcher.js:5)
at Module../node_modules/@docusaurus/core/lib/client/client-lifecycles-dispatcher.js (main.js:79)
at __webpack_require__ (runtime~main.js:36)
at fn (runtime~main.js:340)
at eval (PendingNavigation.js:9)
at Module../node_modules/@docusaurus/core/lib/client/PendingNavigation.js (main.js:63)
at __webpack_require__ (runtime~main.js:36)
at fn (runtime~main.js:340)
at eval (App.js:14)
at Module../node_modules/@docusaurus/core/lib/client/App.js (main.js:55)
at __webpack_require__ (runtime~main.js:36)
at fn (runtime~main.js:340)
at eval (clientEntry.js:7)
at Module../node_modules/@docusaurus/core/lib/client/clientEntry.js (main.js:87)
at __webpack_require__ (runtime~main.js:36)
at __webpack_exec__ (main.js:772)
at main.js:773
at Function.__webpack_require__.O (runtime~main.js:83)
at main.js:774
at webpackJsonpCallback (runtime~main.js:1313)
at main.js:9```
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
@slorber, amazing. Many thanks!
Fix for scala
:
prism: {
additionalLanguages: ['java', 'scala'],
},
In fact I needed to add this to work
additionalLanguages: ['clike', 'java', 'scala'],
}
because of
Prism.languages.java = Prism.languages.extend('clike', {
clike
should be enabled by the renderer by default: https://github.com/FormidableLabs/prism-react-renderer/blob/4d8019490a3ad89c310d877a9ae3130084261bc9/src/vendor/prism/includeLangs.js#L9
Does it not work without that?
Is there a fix for armasm
?
what about php guys ? its not working
Same for me, PHP not working with error in console:
Uncaught Error: Cannot find module './prism-php.js'
My config:
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ['php'],
},
It seems to be a path problem since I do have the file node_modules/prismjs/components/prism-php.js
.
@franck-grenier i solved the issue by restarting the devlopment server
Just in case someone else ends up here with the same issue that I had, I'll quote the comment from @ArthurFlag here:
I do not use scala anywhere, but your suggestion fixed it.
Indeed, I too don't use have any scala code blocks in my docs, but somehow adding scala to the additionalLanguages
array fixed the TypeError: Cannot set properties of undefined (setting 'triple-quoted-string')
error that I was having (which I assume is the same as the Cannot set property 'triple-quoted-string' of undefined
error reported in #5013).
š 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
2.0.0-alpha.50
.docusaurus.config.js
withinthemeConfig
addnpm 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:
Your Environment
2.0.0-alpha.50
Mozilla Firefox 74.0.1
NodeJS v13.12.0
(also tried with 12, 11, and 10)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.