Code Monkey home page Code Monkey logo

Comments (10)

algoritmau avatar algoritmau commented on May 22, 2024 2

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:
Screen Shot 2021-11-20 at 12 15 32 PM

from nextra.

suica avatar suica commented on May 22, 2024 2

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.

from nextra.

LucaNerlich avatar LucaNerlich commented on May 22, 2024 1

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.

from nextra.

naufaldi avatar naufaldi commented on May 22, 2024

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

from nextra.

LucaNerlich avatar LucaNerlich commented on May 22, 2024

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.

from nextra.

shuding avatar shuding commented on May 22, 2024

Can't reproduce this personally, I think more insights are needed from the community. Will keep eyes open on this!

from nextra.

phc5 avatar phc5 commented on May 22, 2024

When I use npm install -> npm run dev, syntax highlighting does not work.

If I use yarn, then it works.

from nextra.

daltonturner avatar daltonturner commented on May 22, 2024

I'm having the same issue with Swift syntax highlighting @spaceinvadev is experiencing.

from nextra.

daltonturner avatar daltonturner commented on May 22, 2024

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!

from nextra.

dimaMachina avatar dimaMachina commented on May 22, 2024

closing since works fine in beta 2

from nextra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.