npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

comrak-wasm

v0.0.10

Published

Comrak markdown parser compiled to WebAssembly

Readme

comrak-wasm

GitHub Actions License NPM version

Comrak markdown parser compiled to WebAssembly with JavaScript bindings. Documentation is avaliable at https://npmx.dev/package-docs/comrak-wasm/.

Usage

For information regarding compatibility, see COMPATIBILITY.md. For usage examples, see jeremy-code/comrak-wasm-examples.

Browser

import init, { markdownToHtml } from "comrak-wasm";

await init();
const html = markdownToHtml(
    `# Hello world!
1. Do ~~you~~ like [pretty](#) paintings?
2. Or *pretty* music?
`,
    {
        extension: {
            strikethrough: true,
        },
    },
);

// <h1>Hello world!</h1>
// <ol>
// <li>Do <del>you</del> like <a href="#">pretty</a> paintings?</li>
// <li>Or <em>pretty</em> music?</li>
// </ol>
//
console.log(html);

Node.js

import { createReadStream } from "node:fs";
import { fileURLToPath } from "node:url";
import init, { markdownToHtml } from "comrak-wasm";

const wasmModuleResponse = new Response(
    createReadStream("comrak-wasm/comrak_wasm_bg.wasm"),
);
wasmModuleResponse.headers.set("Content-Type", "application/wasm");

await init({ module_or_path: wasmModuleResponse });
const html = markdownToHtml(/* ... */);

Deno

You can use the init function with no configuration if you have --allow-read option enabled.

import init, { markdownToHtml } from "comrak-wasm";

await init();
const html = markdownToHtml(/* ... */);

Bun

import init, { markdownToHtml } from "comrak-wasm";

await init();
const html = markdownToHtml(/* ... */);

Bundler

Vite

import init, { markdownToHtml } from "comrak-wasm";
import wasmModuleUrl from "comrak-wasm/comrak_wasm_bg.wasm?url";

await init({
    // Alternatively, `import.meta.resolve("comrak-wasm/comrak_wasm_bg.wasm")`
    module_or_path: new URL(wasmModuleUrl),
});
const html = markdownToHtml(/* ... */);

You might also consider importing the Wasm module from a CDN like so:

import init, { markdownToHtml } from "comrak-wasm";

await init({
    module_or_path: fetch(
        // https://unpkg.com/comrak-wasm@^0.0.1/comrak_wasm_bg.wasm
        "https://esm.sh/comrak-wasm@^0.0.1/comrak_wasm_bg.wasm",
        {
            headers: {
                Accept: "application/wasm",
            },
        },
    ),
});
const html = markdownToHtml(/* ... */);

Webpack

If experiments.futureDefault is enabled, then use ?url like Vite. Otherwise, update your webpack config like this:

import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

export default {
    entry: "./src/index.js",
    output: {
        filename: "main.js",
        path: resolve(__dirname, "dist"),
    },
    module: {
        rules: [
            {
                // Or if you don't want to use a resourceQuery, you can enable it for .wasm files
                // test: /\.wasm/,
                resourceQuery: /url/,
                type: "asset/resource",
            },
        ],
    },
};

Cloudflare Workers

Cloudflare Workers ban the usage of WebAssembly.compile, WebAssembly.compileStreaming, WebAssembly.instantiate with arbitrary data and WebAssembly.instantiateStreaming.^1 In workerd, a Wasm file can be directly imported as a WebAssembly.Module object.[^2]

import wasmModule from "comrak-wasm/comrak_wasm_bg.wasm";
import init, { markdownToHtml } from "comrak-wasm";

await init({
    module_or_path: wasmModule /* WebAssembly.Module */,
});

const html = markdownToHtml(/* ... */);

[^2]: See https://github.com/cloudflare/workers-sdk/blob/b8fd112136abf4ff17c3d456eaa7b22880bcaf6a/packages/miniflare/src/runtime/config/generated/workerd.ts#L933-L941 and https://github.com/cloudflare/workers-sdk/blob/b8fd112136abf4ff17c3d456eaa7b22880bcaf6a/fixtures/wasm-app/worker/module/export_wasm.js#L4

License

This project is licensed under the BSD 2-Clause. See the LICENSE file for details.