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

docs: add MDXLayoutProps to README #4700

Merged
merged 5 commits into from
Sep 22, 2022
Merged

docs: add MDXLayoutProps to README #4700

merged 5 commits into from
Sep 22, 2022

Conversation

bholmesdev
Copy link
Contributor

Changes

  • Add MDXLayoutProps utility to MDX README. Includes difference with MarkdownLayoutProps, and advises using MarkdownLayoutProps instead when sharing a layout across .md and .mdx.
  • Add "layout props" section to explain props available.

Testing

N/A

Docs

Uh yeah

@bholmesdev bholmesdev requested a review from a team as a code owner September 9, 2022 19:44
@changeset-bot
Copy link

changeset-bot bot commented Sep 9, 2022

🦋 Changeset detected

Latest commit: d1ad739

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@astrojs/mdx Patch
@e2e/preact-component Patch
@e2e/react-component Patch
@e2e/solid-component Patch
@e2e/svelte-component Patch

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Sep 9, 2022
Copy link
Member

@sarah11918 sarah11918 left a 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! 💜

@@ -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._
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_**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?"

Copy link
Contributor Author

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!

Copy link
Member

Choose a reason for hiding this comment

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

LGTM!

packages/integrations/mdx/README.md Outdated Show resolved Hide resolved
bholmesdev and others added 2 commits September 12, 2022 11:27
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
@matthewp matthewp merged commit e5f7114 into main Sep 22, 2022
@matthewp matthewp deleted the docs/mdx-layout-props branch September 22, 2022 18:35
@astrobot-houston astrobot-houston mentioned this pull request Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants