nextjs-blog-starter icon indicating copy to clipboard operation
nextjs-blog-starter copied to clipboard

Code highlighting is not working

Open jaydeepw opened this issue 1 year ago • 7 comments

Describe the bug A clear and concise description of what the bug is. When I install the dependencies successuflly and run npm run dev, the web app pops up in the browser successfully.

But when I goto http://localhost:3001/posts/markdown-reference I dont see correct highlighting of the code that is present in the mardown.

Check images attached

To Reproduce Steps to reproduce the behavior:

  1. Run npm run dev
  2. Go to /posts/markdown-reference
  3. Scroll down to the header named JSX or HTML
  4. The code sample is not highlighted

Expected behavior In step no. 4 above, the code sample should be highlighted.

Screenshots Screenshot 2024-11-14 at 11 12 36 AM

Desktop (please complete the following information):

  • OS: Mac OS Sonoma 14.1
  • Browser Brave v1.73.89, Chrome latest

jaydeepw avatar Nov 14 '24 05:11 jaydeepw

Hi @jaydeepw

Thanks for opening this issue. The syntax highlighting should now be fixed!

CleanShot 2024-11-19 at 21 39 23@2x

Closing this issue, but feel free to reopen if there's anything else

sandypockets avatar Nov 20 '24 02:11 sandypockets

Thanks, sounds good.

jaydeepw avatar Nov 20 '24 14:11 jaydeepw

I think the issue is still not fixed. I did a fresh clone of the repo and installed the deps and gave it a spin.

However, I still dont see the right behavior. Please check the attached .gif code-highlighting1

jaydeepw avatar Nov 20 '24 15:11 jaydeepw

Thanks for sending over this gif. I just did a fresh clone myself and it worked without issue (in an incognito tab).

I noticed in your gif that the text, particularly the header navigation, and the headings, is using what looks like OS fallback fonts, and doesn't match the fonts that are used in the project (visible in the demo, here).

Screenshot from your gif CleanShot 2024-11-20 at 20 05 38@2x

Screenshot of demo CleanShot 2024-11-20 at 20 07 57@2x

The demo is a live instance of this repo (hosted on Vercel), so if the demo website is working normally, then cloning this repo should work normally too.

With all that in mind, it seems like the issue might be unrelated to the syntax highlighting, and that there might be some other configuration on your machine or browser that's preventing the page from fully loading, causing some font imports or package imports to fail.

Can you tell me a bit more about your set up, like what browser and version you're using, as well as which version of Node you're using? Do you see any errors in the console or failures in the network tab in your browser?

sandypockets avatar Nov 21 '24 01:11 sandypockets

I noticed, after reloading the page I get the results that you are talking about. But on first load, it shows like my GIF image shows.

I am attaching another GIF for more clarity.

code-highlighting1

Can you tell me a bit more about your set up, like what browser and version you're using, as well as which version of Node you're using? Do you see any errors in the console or failures in the network tab in your browser?

I am using Brave, but same problem with Chrome too. I am using node v20.18.0 I dont see any errors in the console on the first load neither on refresh.

Also, the demo hosted on Vercel behaves the same like in my attached GIF in this comment. Interesting problem.

jaydeepw avatar Nov 21 '24 15:11 jaydeepw

Thanks for including this and testing out the demo! It seems that the issue is indeed still unresolved, as I was able to replicate the error on the demo.

It seems the issue is actually with my machine, and not yours. Must have some cached content or something. I'll continue investigating and circle back once I have a solution in the works.

sandypockets avatar Nov 24 '24 02:11 sandypockets

Sounds good. Please update when ready, I will test out and confirm.

jaydeepw avatar Nov 24 '24 03:11 jaydeepw