Closed Ddupasquier closed 1 year ago
I think the issue might be this line. The value passed to code
should be a string, not a function.
<Highlight code={() => htmlCode(example.component)} />
Try this instead:
<Highlight code={htmlCode(example.component)} />
I think the issue might be this line. The value passed to
code
should be a string, not a function.<Highlight code={() => htmlCode(example.component)} />
Try this instead:
<Highlight code={htmlCode(example.component)} />
Aaaaaaaahhhhhh xD
I've come to figure out that I put in all that work for nothing, anyways. For some reason I thought I wanted to display the compiled html, but what I actually wanted is to display the way I would want the user of the library to use the component. So unfortunately I've opted for just strings anyways.
Here is the repo if you want to fiddle with the code: https://github.com/Ddupasquier/mysvelte_ui/blob/try-html/src/lib/CodeBlock.svelte npm run dev
I am dynamically retrieving my html with this function:
But when I attempt to use this function where I'm passing the 'code' to the highlight component, I'm getting a console error.
Here is the {#each} block where I am passing the html string into the component:
And here is the structure of the 'example' object: