Trying to determine how to use custom Svelte Components with Carta #59
Replies: 4 comments 11 replies
-
I see here: #43 that there is a I've used the |
Beta Was this translation helpful? Give feedback.
-
Hi, since this is question is asked quite frequently, I created a dedicated guide on how to use Svelte components inside Carta. If you just want to replace images with a custom component, you could just skip to the last part, where rendered placeholders( Edit: there is now a dedicated plugin for using components |
Beta Was this translation helpful? Give feedback.
-
Your example on the docs posted actually doesn't seem to work: Any ideas why? Went down a big rabbit hole trying to get other things to work, but it doesn't seem to replace nodes properly at all. ? My end goal is to be able to put attributes/props with either markdown directives, or attribute syntax to pass props into custom components. I understand that with custom props in markdown I may have to collect them as html attributes when rendering, I just can't get anything to work first. |
Beta Was this translation helpful? Give feedback.
-
I am almost there, I have many things fixed. Thank you so much for your help. I'm only missing one thing now which I can't find in the Rehype ecosystem documentation, so I'm thinking outloud hoping someone may be able to answer. My goal now is to be able to pass in props to the custom components via markdown.
It creates:
I'm stumped as to why |
Beta Was this translation helpful? Give feedback.
-
I'm trying to understand if it is possible to replace the rendered output with my own Svelte components. If it is possible I'm having a hard time deciphering the Unified system in a way that'd point me in the right direction.
Let's just say that I want to replace the markdown syntax
![alt text](http://url.com)
with my own Svelte Image component, how would I go about doing that?Beta Was this translation helpful? Give feedback.
All reactions