docs: add a note about additional languages needing to be Prism component names (#7110)

This commit is contained in:
Joshua Chen 2022-04-04 10:02:16 +08:00 committed by GitHub
parent 85f47fd8f7
commit 4194925da9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,6 +83,12 @@ Some popular languages like Java, C#, or PHP are not enabled by default.
To add syntax highlighting for any of the other [Prism-supported languages](https://prismjs.com/#supported-languages), define it in an array of additional languages.
:::note
Each additional language has to be a valid Prism component name. For example, Prism would map the _language_ `cs` to `csharp`, but only `prism-csharp.js` exists as a _component_, so you need to use `additionalLanguages: ['csharp']`. You can look into `node_modules/prismjs/components` to find all components (languages) available.
:::
For example, if you want to add highlighting for the PowerShell language:
```js title="docusaurus.config.js"