content icon indicating copy to clipboard operation
content copied to clipboard

use of flatUnwrap and ContentSlot[unwrap] per the docs doesn't iterate properly through content

Open samcarrington opened this issue 2 years ago • 5 comments

Environment

Reproduction

https://stackblitz.com/edit/nuxt-starter-zfuxp6?file=content%2Findex.md,components%2Fcontent%2FcontentList.vue

Describe the bug

Using the useUnwrap composable to unpack and re-render a list from a markdown file no longer effectively iterates through list items in the pass-through of the used slot from the iteration through flatUnwrap into the ContentSlot component.

The v-for iteration runs through the correct number of items, but the ContentSlot :use and unwrap parameters have no effect on the output, and the whole content of the list is rendered into each item rather than a single item.

Additional context

No response

Logs

No response

samcarrington avatar Oct 13 '23 10:10 samcarrington

The only work around I found for this is to pin version to ~2.7.X and do workaround mentioned in nuxt/content#2254 Latter is only needed if you want to use nuxt 3.7+

Lexpeartha avatar Nov 12 '23 17:11 Lexpeartha

Any news on this?

I'd also wish the docs would cover how to use it. I had no idea how the list should look like in my markdown and thought you'd do something like this

. a
. b
. c

the markdown side on how to use named slots other than "default" is also not covered

mklueh avatar Mar 05 '24 07:03 mklueh

I'm having the same issue, right now im worndering if I should use two components or props to print the list items, but as of now, the iteration of list items using <ContentSlot :use="() => item" unwrap="li" /> is not working

gsabater avatar Mar 13 '24 14:03 gsabater