-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Astro.slots.render escaping HTML output #4818
Copy link
Copy link
Closed
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)
Description
What version of astro are you using?
1.2.7
Are you using an SSR adapter? If so, which one?
n/a
What package manager are you using?
npm
What operating system are you using?
Stackblitz
Describe the Bug
We have an API for passing arguments to slot children if they are functions when using the Astro.slots.render, which I’m trying to document.
Expected behaviour
The whole process looks something like this:
-
A component uses
Astro.slots.renderand passes an array of arguments as the second argument when rendering:--- // /src/Component.astro --- {Astro.slots.render('default', ['foo'])}
-
When using the component, you pass a function as its contents to be called with any arguments the component provides:
--- // /src/pages/index.astro import Component from '../Component.astro'; --- <Component> {(arg) => <strong>{arg}</strong>} </Component>
-
It should render the markup returned by the function in the component’s slot:
<!-- expected output --> <strong>foo</strong>
Actual behaviour
Most of the above works as expected, but the HTML markup appears to be escaped resulting in <strong>foo</strong> being output as plaintext in the browser:
<strong>foo</strong>Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-kc4vjm?file=src/ComponentWhichIteratesAList.astro
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)