andi23rosca / solid-markdown

Render Markdown as Solid components
MIT License
106 stars 10 forks source link

Support mermaid charts #22

Open Ladvace opened 12 months ago

Ladvace commented 12 months ago

is there a way to integrate the mermaid charts in the markdown?

imkunet commented 5 months ago

Hi there. I was writing a demonstration on how to do this using rehype-mermaid but then tragedy struck again. This line in this project will (for now) make this task impossible (or at least harder) when using this package.

https://github.com/andi23rosca/solid-markdown/blob/f8a614a00ac5117e4815c9ed5104e98dad688763/src/index.tsx#L71

The attempt at making it work (you can see it throw in console executing the aforementioned line): https://stackblitz.com/edit/solidjs-template-h3p7cj?file=src%2FApp.tsx

For reference, the error:

dev.jsx:9760 Uncaught Error: `runSync` finished async. Use `run` instead
    at assertDone (dev.jsx:9760:11)
    at Function.runSync (dev.jsx:9557:5)
    at Object.fn (dev.jsx:10562:33)
    at runComputation (dev.jsx:6359:23)
    at updateComputation (dev.jsx:6342:3)
    at createMemo (dev.jsx:6188:5)
    at SolidMarkdown (dev.jsx:10551:20)
    at chunk-JG2I5HKG.js?v=be5824c1:633:14
    at untrack (chunk-JG2I5HKG.js?v=be5824c1:513:12)
    at Object.fn (chunk-JG2I5HKG.js?v=be5824c1:629:11)

Likely fixes?

Asynchronous magic, probably.

andi23rosca commented 3 months ago

I'll have to think on this, the library assumes everything will run syncrhonously I might provide a different component for rendering async