-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MDX] Fix remaining inconsistencies with Markdown (#4268)
* feat: add "file" and "url" to layout props * feat: add rawContent and compiledContent errs * fix: add "file" and "url" to frontmatter * fix: add separate MDX instance type * types: add MarkdownLayoutProps and MDXLayoutProps * refactor: simplify MDXLayoutProps * test: pass file and url to layout * test: glob components with .default and Content * feat: add <Content /> to MDX * feat: declare MDX type module * fix: [MD] move file and url to layout props only * chore: changeset * chore: bump MDX to "minor" with more details * refactor: remove "file" + "url" top-level props (save for minor) * revert: MDInstance type def updates (save for minor) * fix: MDXInstance "default" + "content" types * fix: bad test layout * chore: remove getHeaders fro *.mdx
- Loading branch information
1 parent
437bf73
commit f7afdb8
Showing
10 changed files
with
154 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'astro': patch | ||
'@astrojs/mdx': minor | ||
--- | ||
|
||
Align MD with MDX on layout props and "glob" import results: | ||
- Add `Content` to MDX | ||
- Add `file` and `url` to MDX frontmatter (layout import only) | ||
- Update glob types to reflect differences (lack of `rawContent` and `compiledContent`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/integrations/mdx/test/fixtures/mdx-component/src/pages/glob.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
const components = await Astro.glob('../components/*.mdx'); | ||
--- | ||
|
||
<div data-default-export> | ||
{components.map(Component => <Component.default />)} | ||
</div> | ||
|
||
<div data-content-export> | ||
{components.map(({ Content }) => <Content />)} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters