rehype-pretty / rehype-pretty-code

Beautiful code blocks for Markdown or MDX.
https://rehype-pretty.pages.dev
MIT License
1.01k stars 63 forks source link

[feature] standalone RSC component #176

Closed o-az closed 4 months ago

o-az commented 7 months ago

A plugin/component that can be imported and used as a React Server Component. Essentially this example packaged packaged: https://rehype-pretty-code.netlify.app/#react-server-component

It will probably look something like this:

import { PrettyCode } from '@rehype-pretty/rsc'

export default async function Page() {
  return (
    <PrettyCode
      // theme, language, code/filepath, etc.
    />
  )
}

I'm not yet sure if this is feasible but it might be a good idea to do this instead and make it framework agnostic:

import { PrettyCode } from '@rehype-pretty/mdx'

Or if not feasible then: '@rehype-pretty/<framework>'