nextra
nextra copied to clipboard
No syntax hilight for code block
I cloned this repo, run yarn add .
and then yarn dev
, code blocks in localhost website does not have highlights.
i trying to clone it, and when in npm run dev
code blocks dont have highlights. But, trying upload in vercel / npm run build
will has highlights, only in production
Interesting, Im having the same issue, just the other way around, code highlighting works on localhost (next dev and next start) but as soon as I roll it out on prod, code highlighting does not work anymore.
I am using these prism imports
https://nextra.vercel.app/docs/advanced/code-highlighting
Before code highlighting did not work at all.
ive just tested with deployment on vercel and code highlighting works here, it just looks a bit odd, since nextra uses a dark backround for code / pre blocks, which makes text unreadable.
Can't reproduce this personally, I think more insights are needed from the community. Will keep eyes open on this!
When I use npm install
-> npm run dev
, syntax highlighting does not work.
If I use yarn
, then it works.
I'm having this issue as well. I'm trying to enable syntax highlighting for Swift. I followed the instructions and added the needed config to the _app.js
file yet syntax highlighting does not work. Nor for Javascript code snippets.
Here's my _app.js
file:
import Prism from 'prism-react-renderer/prism'
;(typeof global !== 'undefined' ? global : window).Prism = Prism
require('prismjs/components/prism-swift')
import 'nextra-theme-docs/style.css'
import '../styles/globals.css'
export default function Nextra({ Component, pageProps }) {
return <Component {...pageProps} />
}
This is what gets rendered:
I'm having the same issue with Swift syntax highlighting @spaceinvadev is experiencing.
You may try the versions of packages used in https://github.com/shuding/site/blob/master/package.json if you cannot see the code highlighting in blog theme.
You may try the versions of packages used in https://github.com/shuding/site/blob/master/package.json if you cannot see the code highlighting in blog theme.
This worked for me! Thank you, @suica!
closing since works fine in beta 2