-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
docs: add MDXLayoutProps to README #4700
Conversation
🦋 Changeset detectedLatest commit: d1ad739 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bholmesdev! Just a couple quick suggestions for consideration! 💜
packages/integrations/mdx/README.md
Outdated
@@ -222,6 +223,46 @@ const { frontmatter } = Astro.props; | |||
</html> | |||
``` | |||
|
|||
You can also add type safety using [the `Props` type](/en/guides/typescript/#component-props) with the `MDXLayoutProps` helper. | |||
|
|||
_**Note:** `MDXLayoutProps` is the same as the `MarkdownLayoutProps` utility type, with `rawContent()` and `compiledContent()` removed (since these are not available for `.mdx` files). If you understand this difference, feel free to use `MarkdownLayoutProps` instead when sharing a layout across `.md` and `.mdx` files._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_**Note:** `MDXLayoutProps` is the same as the `MarkdownLayoutProps` utility type, with `rawContent()` and `compiledContent()` removed (since these are not available for `.mdx` files). If you understand this difference, feel free to use `MarkdownLayoutProps` instead when sharing a layout across `.md` and `.mdx` files._ | |
:::note | |
`MDXLayoutProps` is the same as the `MarkdownLayoutProps` utility type, with `rawContent()` and `compiledContent()` removed (since these are not available for `.mdx` files). This allows you to use `MarkdownLayoutProps` for type safety when sharing a layout across `.md` and `.mdx` files. | |
::: |
I didn't love the "if you understand this difference." Can we maybe get away with taking that out, and trust that it's implied that if you're not using those two things in your layout, you're good? Or, is there another "caveat/warning" we can use that more explicitly tacks on at the end "as long as you're not using these things?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough! I was a bit confused reading that redraft of the last sentence (okay I'm allowed to, but what does Astro recommend?), so I kept the wording mostly the same with "if you understand..." removed. Lmk if that works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
9a1a074
to
fa79757
Compare
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Changes
MDXLayoutProps
utility to MDX README. Includes difference withMarkdownLayoutProps
, and advises usingMarkdownLayoutProps
instead when sharing a layout across.md
and.mdx
.Testing
N/A
Docs
Uh yeah