Closed SiegeSailor closed 7 months ago
@SiegeSailor Docusaurus offers a special API to declare additional languages. Please see our docs: https://docusaurus.io/docs/markdown-features/code-blocks#supported-languages
@Josh-Cena Thank you for your response. However, I did use the special API to declare additional languages. The error message Uncaught Error: Cannot find module './prism-latex'
comes after I add languages such as latex
to docusaurus.config.js
.
Sorry, I can't reproduce it.
themeConfig: {
prism: {
additionalLanguages: ['latex'],
},
}
```latex
\textit{Hello world!}
<img width="850" alt="image" src="https://user-images.githubusercontent.com/55398995/155845694-a094c09c-1753-4cd3-b16f-bd6de6ea0538.png">
Could you look into `node_modules/prismjs/components` and see if `prism-latex` exists?
@Josh-Cena Thank you for further research.
It looks like that prism-latex
does exist in node_modules/prismjs/components
:
But Uncaught Error: Cannot find module './prism-latex'
pops up when I use the following config:
If I don't set up latex in themeConfig
, then the syntax wouldn't be highlighted:
```latex
f(x)=
\left\{
\begin{matrix}
x^{2} + 1, x \geq 0 \\
x^{2} + 2, x < 0
\end{matrix}
\right.
<img width="623" alt="Screen Shot 2022-02-27 at 23 44 57" src="https://user-images.githubusercontent.com/39463416/155889523-e672ccc0-4d54-4dff-8185-e1909995e9d4.png">
Do you have a reproduction demo? Like your GitHub repo.
@Josh-Cena Here is the repository I am using Docusaurus.
Hi, @Josh-Cena.
Sorry for bothering you. Is there any update?
Unable to reproduce this, please reopen in the docusaurus repo if needed.
Overview
I followed the FAQ How do I add more language highlighting support? on
README.md
to add additional languages other than the languages mentioned here. However, the error popped up:Issue
I then went to check if the languages I wanted to add were in
prism-react-renderer/prism
, but none of them were found:The version I am using is
1.3.1
:I use
prism-react-renderer
indocusaurus
. Here is my code in.md
: