nuxtlabs / remark-mdc

Remark plugin to support MDC syntax.
https://remark-mdc.nuxt.space
MIT License
53 stars 5 forks source link

Scoped slots #69

Open ManUtopiK opened 11 months ago

ManUtopiK commented 11 months ago

Is your feature request related to a problem? Please describe.

How to handle scoped slots with MDC syntax ? And how to pass slot props to child components ?

Describe the solution you'd like to see

From this template :

<!-- <MyComponent> template -->
<div>
  <slot :text="greetingMessage" :count="1"></slot>
</div>

To this :

::my-component
#default{text count}
This is a {{ text }} and a {{ count }}
This is an inline :child-component{text=":text" count=":count"}
::

:thinking: I'm not convinced. We should take care about the v-bind shorthand : with the frontmatter. doc

What do you think about ?

atinux commented 11 months ago

What is the main use case for this? I am afraid we might go too far by supporting scoped slots

ManUtopiK commented 10 months ago

I am afraid we might go too far by supporting scoped slots

I understand well. For now, I duplicate components or use composable as a workaround. But I think the more I go with mdc, the more I'll need this feature. If you want, you can close this issue for now...

adamdehaven commented 2 months ago

What is the main use case for this? I am afraid we might go too far by supporting scoped slots

@atinux I've outlined a decent use case here https://github.com/nuxt-modules/mdc/issues/43#issuecomment-2318956997 involving looping through front matter arrays for nested components