onCodeBlock is sync, but as it's called from WASM code it will be asynchronous between workers.
Synchronous parsing of code blocks is fine for text, but fails for tools like Mermaid https://github.com/mermaid-js that render something using the code. Mermaid's render actions return a Promise and there's no way to resolve it synchronously.
To handle this, onCodeBlock should be async and support returning a Promise.
onCodeBlockis sync, but as it's called from WASM code it will be asynchronous between workers.Synchronous parsing of code blocks is fine for text, but fails for tools like Mermaid https://github.com/mermaid-js that render something using the code. Mermaid's render actions return a
Promiseand there's no way to resolve it synchronously.To handle this,
onCodeBlockshould beasyncand support returning aPromise.