nextra-theme-docs uses Prism and prism-react-renderer
to highlight the code blocks. This section covers how you can customize it.
To keep the bundle small, only a subset of languages are included in the syntax highlighter. If you want to add more languages, you can do the following:
yarn add prismjs prism-react-rendererto add dependencies to your Nextra project.
- Add the following code to your
import Prism from 'prism-react-renderer/prism'(typeof global !== "undefined" ? global : window).Prism = Prismrequire("prismjs/components/prism-kotlin")require("prismjs/components/prism-csharp")
Restart your app and you will have Kotlin and C# code highlighting supported. You can find the full list of available languages here.