Skip to content

"Copy Page" with component contents for .mdx pages #4832

@finom

Description

@finom

Is your feature request related to a problem? Please describe.

I use Nextra to document code from Github repositories in details. For that I use a custom React component that pulls the code on build time:

See the code:
<GithubFiles paths={['src/modules/database/DatabaseEventsService.ts']} repo="my-repo" />

Problem is that when "Copy Page" is used, it copies the React components as is, making it impossible for AI to process input like that.

Describe the solution you'd like

Would be great if "Copy Page" would be able to copy desired content from React components. I'm thinking of a kind of data attribute that would contain contents of the component, that would be appended next to the React component. Let's say GithubFiles generates <div data-copy-contents="```ts\nconst x = 'foo';\n```" /> that would turn the "Copy Page" contents into:

See the code:
<GithubFiles paths={['src/modules/database/DatabaseEventsService.ts']} repo="my-repo" />
``ts
const x = 'foo';
``

Describe alternatives you've considered

I know it sounds a bit overengeneered, and I would be happy to know any other alternative to my proposal, because my documentation either going to loose 100% accuracy, or users wouldn't be able to prompt LLMs with the page contents. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions