A JavaScript WebAssembly wrapper for the pulldown-cmark
library.
import { parse } from "pulldown-cmark";
parse("# Hello world!");
if your bundler does not support WebAssembly (WASM) out of the box, use the init function to manually initialize the WASM module.
import init, { parse } from "pulldown-cmark/init";
await init()
parse("# Hello world!");
Enable WASM in Vite by importing and configuring the required plugins.
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [wasm(), topLevelAwait()],
});
Enable WASM in Webpack by adjusting the experiments configuration.
module.exports = {
//... (other config properties)
experiments: {
asyncWebAssembly: true,
layers: true,
topLevelAwait: true,
},
};