ssssota / svelte-exmarkdown

Svelte component to render markdown.
https://ssssota.github.io/svelte-exmarkdown
MIT License
198 stars 7 forks source link

Support for asynchronous plugins #274

Open rishikanthc opened 1 month ago

rishikanthc commented 1 month ago

I was trying to use the rehypeShiki (from here) plugin with svelte-exmarkdown. I hit this error:

Error: runSync finished async. Use run instead
    at assertDone (/Users/richandrasekaran/Code/m/node_modules/svelte-exmarkdown/dist/utils.js:9950:11)
    at Function.runSync (/Users/richandrasekaran/Code/m/node_modules/svelte-exmarkdown/dist/utils.js:9743:5)
    at /Users/richandrasekaran/Code/m/node_modules/svelte-exmarkdown/dist/utils.js:10013:28
    at Module.Markdown [as default] (/Users/richandrasekaran/Code/m/node_modules/svelte-exmarkdown/dist/Markdown.svelte:29:34)
    at _page (/Users/richandrasekaran/Code/m/src/routes/notes/[...path]/+page.svelte:43:31)
    at children (/Users/richandrasekaran/Code/m/.svelte-kit/generated/root.svelte:69:5)
    at _layout (/Users/richandrasekaran/Code/m/src/routes/+layout.svelte:23:12)
    at Root (/Users/richandrasekaran/Code/m/.svelte-kit/generated/root.svelte:64:3)
    at Module.render (/Users/richandrasekaran/Code/m/node_modules/svelte/src/internal/server/index.js:117:2)
    at Function._render [as render] (/Users/richandrasekaran/Code/m/node_modules/svelte/src/legacy/legacy-server.js:27:18)

Looks like svelte-exmarkdown expects synchronous operation only. I'm having to create a rather cumbersome workaround to get this to work.. Any help would be appreciated.

By the way thanks for the awesome plugin. Was looking for this exact solution as I hat the same problems you mentioned in your motivation.

ssssota commented 1 month ago

I added a document to use shiki as plugin! Please check it: https://ssssota.github.io/svelte-exmarkdown/docs/10-shiki