shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.7k stars 1.27k forks source link

Improve Twoslash Popover Display in Nextra #3361

Open Zih0 opened 1 week ago

Zih0 commented 1 week ago

Hello,

I would like to propose an enhancement regarding the display of the Twoslash popovers in Nextra. In the official Twoslash documentation, the popovers are displayed above the code blocks, which makes it easy to view the content. However, in Nextra, the popovers seem to be cut off inside the code blocks, making it difficult to read the content, especially when the popover is longer.

Would it be possible to implement a custom popover component in Nextra to address this issue? I noticed that the official Shiki/Twoslash documentation provides a renderer for Vue users (as seen here: https://shiki.matsu.io/packages/twoslash#rendererfloatingvue), and it seems feasible to create a similar implementation for React.

Additionally, another Next.js documentation library, Fumadocs, has already implemented this feature (you can find it here: https://github.com/fuma-nama/fumadocs/blob/1e715c93e53051fd699981e5c05c98750af7d6e6/packages/twoslash/src/index.ts#L38).

I believe this improvement would significantly enhance the user experience for those working with code blocks in Nextra. I would greatly appreciate your consideration of this request.

Thank you for your time and effort!

shiki/twoslash docs nextra docs
SCR-20241005-bwfc SCR-20241005-buuf
dimaMachina commented 1 week ago

Definitely good improvement šŸ‘

dimaMachina commented 1 day ago

Hi, would you like to submit the PR? Since you already investigated how to fix it šŸ˜