shuding / nextra

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

Are nextra code highlight suport grammar `// ^?` and `// ^|` #2525

Closed tianyingchun closed 10 months ago

tianyingchun commented 1 year ago

Hope nextra code hilight can support grammar // ^?, please see below case

.query((opts) => {
      const name = opts.input.name;
      //    ^?
      return {
        greeting: `Hello ${opts.input.name}`,
      };
    }),

the output should be

image

second case

 .query((opts) => {
      return {
        gre,
        // ^|
      };
    })
image

please see: https://github.com/trpc/trpc/blob/main/www/docs/server/validators.md

dimaMachina commented 12 months ago

This feature looks nice, and I am +1 to add it to Nextra, would you want to make an attempt to contribute? preferable to set v3 as base branch to avoid fixing conflicts with future release

I think there is some remark/rehype plugin to do it

imranbarbhuiya commented 10 months ago

I can work on this after #2658 (after https://github.com/rehype-pretty/rehype-pretty-code/pull/172) gets merged looks live there's already a pr for that

dimaMachina commented 10 months ago

will be added in next alpha release