Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recma-nextjs-static-props to list of plugins #2033

Merged
merged 2 commits into from May 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/docs/extending-mdx.server.mdx
Expand Up @@ -68,6 +68,8 @@ You can use this template:
See also the [list of remark plugins][remark-plugins] and
[list of rehype plugins][rehype-plugins].

* [`remcohaszing/recma-nextjs-static-props`](https://github.com/remcohaszing/recma-nextjs-static-props)
— expose top-level identifiers in Next.js `_app.js`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For here:

  • Is this really about app.js/_app.js 🤔

For your readme:

  • Should your readme mention that include can include things which are not defined without a problem? E.g., whateverKey, when not exported from an MDX file, whether that’s fine?
  • Maybe a more practical example in your readme with an example MDX file that exports something, and how it can be used on the receiving end?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exposing it in _app.js is the goal, using getStaticProps is the mean. I think it's clear what the plugin does, but I struggle a bit to explain it in a one-line description. I'm open to suggestions.

Thanks for the readme suggestions! I'll add both 👍

Copy link
Member

@wooorm wooorm May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so app.js is how one could pass components to MDX without a provider! Other users before didn’t know that and instead used the provider: #2032 and many similar.

You might want to link to the docs for app.js?

For a description, I’m thinking along the lines of:

automatically export things from MDX pages to Next.js (like `getStaticProps`)

But, agree that it’s tough. And this is still a bit long.

Maybe:

generate `getStaticProps` and similar for Next.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

friendly ping! :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I settled on:

generate getStaticProps exposing top level identifiers in Next.js

I think it’s also important to include what the generated getStaticProps does, as it’s not self-explanatory.

* [`remcohaszing/rehype-mdx-title`](https://github.com/remcohaszing/rehype-mdx-title)
— expose the page title as a string
* [`remcohaszing/remark-mdx-code-meta`](https://github.com/remcohaszing/remark-mdx-code-meta)
Expand Down