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

@y1feng200156/awsm-markdown-renderer

v0.2.2

Published

A high-performance, universal Markdown renderer written in Rust and compiled to WebAssembly (Wasm).

Readme

AWSM Markdown Renderer

A high-performance, universal Markdown renderer written in Rust and compiled to WebAssembly (Wasm).

It is designed to run everywhere: Browsers, Node.js, Next.js, and Cloudflare Workers.

Features

  • Universal Support: Works seamlessly in Next.js (Edge/Node runtimes) and Cloudflare Workers without complex configuration.
  • Fast: Built with Rust and pulldown-cmark.
  • Zero-Config Initialization: Auto-initializes Wasm in standard environments.
  • Syntax Highlighting: Uses syntect for compile-time generated syntax dumping (no huge JS runtime bundles).
  • Math Support: Renders LaTeX to MathML using latex2mathml (Validation compatible).
  • GFM Support: Tables, Strikethrough, Tasklists, Footnotes.

Installation

npm install @y1feng200156/awsm-markdown-renderer

Usage

1. Next.js / React / Browser (Standard)

In standard environments (like Next.js Server Components, Client Components, or plain HTML), the renderer automatically handles the Wasm initialization.

import { render_markdown } from '@y1feng200156/awsm-markdown-renderer';

async function main() {
    const markdown = `
# Hello World
This is **bold** text.
    `;

    // Just call it! No need to manually init().
    const html = await render_markdown(markdown);
    
    console.log(html);
}

main();

Note for Next.js: Ensure asyncWebAssembly is enabled in your next.config.mjs.

2. Adding Styles for Code Blocks

The renderer generates syntax-highlighted code blocks with CSS classes, but you need to include the styles to see the colors. We provide a ready-to-use CSS file with CSS variables for easy customization.

Option A: Import the CSS file (Recommended)

// In your app entry file or layout
import '@y1feng200156/awsm-markdown-renderer/code-highlight.css';

Option B: Copy CSS variables to your own stylesheet

If you prefer to customize the theme, copy the CSS variables from code-highlight.css and adjust the colors to match your design.

Available CSS Variables

:root {
  /* Code block container (light theme default) */
  --awsm-code-bg: #f6f8fa;
  --awsm-code-fg: #24292e;
  --awsm-code-border: #e1e4e8;
  --awsm-code-border-radius: 8px;
  --awsm-code-padding: 1rem;

  /* Syntax colors */
  --awsm-syntax-text: #24292e;
  --awsm-syntax-comment: #6a737d;
  --awsm-syntax-keyword: #d73a49;
  --awsm-syntax-string: #032f62;
  --awsm-syntax-number: #005cc5;
  --awsm-syntax-function: #6f42c1;
  --awsm-syntax-variable: #e36209;
  --awsm-syntax-type: #005cc5;
  /* ... and more */
}

Dark Theme Support

Add data-theme="dark" to your HTML or a parent element to enable the dark theme:

<html data-theme="dark">

3. Cloudflare Workers (Edge)

Cloudflare Workers require you to explicitly import the .wasm file and pass it to the renderer.

// worker.ts
import { render_markdown } from '@y1feng200156/awsm-markdown-renderer';

// Import the WASM file explicitly (Wrangler handles the bundling)
import wasm from '@y1feng200156/awsm-markdown-renderer/awsm_markdown_renderer_bg.wasm';

export default {
  async fetch(request, env, ctx) {
    const markdown = "# Hello from Edge!";
    
    // Pass the wasm module as the second argument
    const html = await render_markdown(markdown, wasm);

    return new Response(html, {
      headers: { "content-type": "text/html" },
    });
  },
};

Building Locally

Requirements:

  • Rust (latest stable)
  • wasm-pack
# 1. Install wasm-pack (if not installed)
curl [https://rustwasm.github.io/wasm-pack/installer/init.sh](https://rustwasm.github.io/wasm-pack/installer/init.sh) -sSf | sh

# 2. Build the Wasm module
wasm-pack build --target web --scope y1feng200156

# 3. Run Post-Processing
# This step injects the wrapper and updates package.json for universal support
cargo run --bin post_process

License

MIT