nextra icon indicating copy to clipboard operation
nextra copied to clipboard

Rehype support highlighting with URL parameter

Open champsupertramp opened this issue 1 year ago • 3 comments

Hello Gentlemen,

I hope to make the Rehype Code Highlighter support highlighting codes with URL parameters like the following:

http://localhost:3007/modules/overview?filename=my-file.js{2-3}

Has this been requested and should I look for another component for this case?

Thank you!

champsupertramp avatar Sep 14 '22 12:09 champsupertramp

This is tricky, first you'll have to make your site always SSR, then you need a way to dynamically render the codeblock and pass options to it.

Overall this is a very strange use case to me, may I ask why you need that?

shuding avatar Sep 15 '22 11:09 shuding

I think the same as @shuding, don’t see much benefit of it, also your query params should contain a param or hash of which code block you wanna change in the case if there are many code blocks on the page

dimaMachina avatar Sep 15 '22 11:09 dimaMachina

Hi @shuding @B2o5T

Thank you for taking the time for this inquiry!

I'm trying to connect the source links from this page: Screen Shot 2022-09-17 at 12 25 18 AM

to this code page but I'm thinking I should just link it to our Github repo: Screen Shot 2022-09-17 at 12 25 27 AM

champsupertramp avatar Sep 16 '22 16:09 champsupertramp

closed as too overkill

dimaMachina avatar Oct 14 '22 01:10 dimaMachina

Hi @B2o5T

Just to add for those who are using the rehype.

I've experienced performance issues when using rehype with source codes that have more than 1,000 lines. It was failing to deploy on Vercel servers.

Thank you

champsupertramp avatar Oct 14 '22 05:10 champsupertramp