Replies: 3 comments
-
Wanted to quickly chime in to say that at my current workplace, we have the same use case. It would be very handy for us to be able to have access to the raw, as is, content of an astro component's slot. |
Beta Was this translation helpful? Give feedback.
-
This looks like a good idea. |
Beta Was this translation helpful? Give feedback.
-
I have a case where I want to create an inline code tag and I prefer to have a raw html content rather then rendering one with additional attributes (such as Astro.slots.raw('default') This would be more clear imho. |
Beta Was this translation helpful? Give feedback.
-
Body
Summary
The Astro.slot.render() function does a great job of rendering slot to html, but it would also be extremely helpful if it could also support rendering the passed in data as-is.
Background & Motivation
Astro is an extremely useful framework for us because it allows us to render any component regardless of language. We internally use this to build documentation for UI components similar to storybook.
We build a custom docs templates that allow us to pass in the component and render the preview and html code snippet like so:
Currently we are successfully able to render both the preview and html code snippet, however we also need the ability to render the unrendered snippet like so:
Goals
What we need is the ability to do something like,
Astro.slot.render('default', 'raw')
to pull the raw unrendered slot value.Example
It would be great if the Astro.slot.render() could accept a second parameter that defines the format:
Astro.slot.render('default', 'raw')
orAstro.slot.render('default', 'html')
(default)Beta Was this translation helpful? Give feedback.
All reactions