-
-
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.
Support Astro.slots.render for mdx (#4973)
* Support Astro.slots.render for mdx * Remove extra imports
- Loading branch information
Showing
8 changed files
with
69 additions
and
2 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,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Support Astro.slots.render for mdx |
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
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/slots-react/src/components/Render.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,6 @@ | ||
--- | ||
const { id } = Astro.props; | ||
const content = await Astro.slots.render('default'); | ||
--- | ||
|
||
<div id={id} set:html={content} /> |
5 changes: 5 additions & 0 deletions
5
packages/astro/test/fixtures/slots-react/src/components/RenderArgs.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,5 @@ | ||
--- | ||
const { id, text } = Astro.props; | ||
--- | ||
|
||
<div id={id} set:html={Astro.slots.render('default', [text])} /> |
6 changes: 6 additions & 0 deletions
6
packages/astro/test/fixtures/slots-react/src/components/RenderFn.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,6 @@ | ||
--- | ||
const { id } = Astro.props; | ||
const content = await Astro.slots.render('default'); | ||
--- | ||
|
||
<div id={id} set:html={content} /> |
9 changes: 9 additions & 0 deletions
9
packages/astro/test/fixtures/slots-react/src/pages/slottedapi-render.mdx
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 @@ | ||
import Render from '../components/Render.astro'; | ||
import RenderFn from '../components/RenderFn.astro'; | ||
import RenderArgs from '../components/RenderArgs.astro'; | ||
|
||
# Slots: MDX | ||
|
||
<Render id="render">render</Render> | ||
<RenderFn id="render-fn">{() => "render-fn"}</RenderFn> | ||
<RenderArgs id="render-args" text="render-args">{(text) => <span>{text}</span>}</RenderArgs> |
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