Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Components with array-like prop fail to render in Markdown #2399

Closed
Destiner opened this issue Jan 15, 2022 · 3 comments · Fixed by #3410
Closed

🐛 BUG: Components with array-like prop fail to render in Markdown #2399

Destiner opened this issue Jan 15, 2022 · 3 comments · Fixed by #3410
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: markdown Related to Markdown (scope)

Comments

@Destiner
Copy link

What version of astro are you using?

0.22.11

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

I have a component that takes an array as a prop. I then use this component in a markdown file with setup. When that markdown is rendered, I get something along the lines of <ComponentName propName=[[Object object][Object object]] /> rendered a string. Interestingly, passing empty array to them component seems to work (nothing gets rendered).

I tried to create a Vue component as well and got the same result.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-fdsvay?file=src%2Fpages%2Findex.md

@toSayNothing
Copy link
Contributor

according to the document,

Markdown Pages

Astro treats any .md files inside of the /src/pages directory as pages. These files can contain frontmatter, but are otherwise processed as plain markdown files and do not support components. If you’re looking to embed rich components in your markdown, take a look at the Markdown Component section.

so you can use the MarkDown component in .astro file to render the customize component.
eg : https://stackblitz.com/edit/github-fdsvay-rqehaz?file=src/pages/index.astro

@jonathantneal
Copy link
Contributor

I think there is an issue with how attributes are serialized. I’m going to track this as a bug. In the meantime, @toSayNothing, thank you for sharing that workaround.

@natemoo-re
Copy link
Member

Confirming that this is still an issue in the latest version. https://stackblitz.com/edit/github-fdsvay-qeaaxz?file=src%2Fpages%2Findex.md,src%2Fcomponents%2FTodoList.astro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: markdown Related to Markdown (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants