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

prosemirror-rs

v0.3.7

Published

Node.js bindings for prosemirror-rs: a Rust implementation of ProseMirror's document model and transform pipeline

Readme

prosemirror-rs — Node.js bindings

Node.js bindings for prosemirror, a Rust implementation of ProseMirror's document model and transform pipeline.

Installation

npm install prosemirror-rs

Design goals

  • Zero unnecessary copies. The schema and document live entirely in Rust memory. Only JSON strings cross the JavaScript/Rust boundary.
  • Wire-efficient. Steps arriving as JSON (e.g. from a WebSocket) can be passed directly to applyStepsJson() without any JS-level parsing.
  • Database-efficient. docJson() serializes the document in Rust and returns a plain JS string, ready to write to a database with no intermediate objects.

Quick start

const { Editor } = require('prosemirror-rs');

const schemaJson = JSON.stringify({
    nodes: {
        doc:       { content: 'paragraph+' },
        paragraph: { content: 'text*', group: 'block' },
        text:      { group: 'inline' },
    },
    marks: { strong: {}, em: {} },
});

const docJson = JSON.stringify({
    type: 'doc',
    content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Hello' }] }],
});

const editor = new Editor(schemaJson, docJson);
console.log(editor.version);   // 0

// Typical server loop: steps arrive as raw JSON from a WebSocket client
wss.on('message', (raw) => {
    const data = JSON.parse(raw);                     // parse envelope only
    const ok = editor.applyStepsJson(                 // steps stay as JSON string
        JSON.stringify(data.steps)
    );
    if (ok) {
        db.execute('UPDATE docs SET body = $1', [editor.docJson()]);
    }
});

Building from source

cd node
npm run build   # runs cargo build --release + copies the .node artifact
npm test        # build + run the test suite

API reference

new Editor(schemaJson, docJson)

Create an editor. Both arguments are JSON strings (schema spec and initial document). Throws Error on malformed input.

editor.applyStep(stepJson) → boolean

Apply one step supplied as a JSON string. Returns true on success, false if the step cannot be applied (document is left unchanged). Throws Error on invalid JSON.

editor.applyStepsJson(stepsJson) → boolean

Preferred method for incoming network data. Accepts a JSON array of steps as a single string — passed directly to Rust and parsed there, so nothing touches JS's JSON machinery.

The batch is atomic: if any step fails the document and version are rolled back entirely and false is returned. Throws Error on invalid JSON.

editor.applySteps(steps) → boolean

Convenience method for when steps are constructed or modified in JavaScript. Each element of steps is a JSON string for one step.

The batch is atomic: if any step fails the document and version are rolled back entirely and false is returned. Throws Error on invalid JSON.

editor.reset(docJson)

Replace the document with a new one, reusing the already-parsed schema. Resets the version counter to zero. Throws Error on malformed input.

editor.docJson() → string

Return the current document as a compact JSON string. Serialized entirely in Rust; only the final string is passed to JavaScript — suitable for direct database writes with no intermediate objects.

editor.version (number, read-only)

Number of steps successfully applied since construction or the last reset(). Use as a document version counter in collaborative-editing protocols.

Credits

The underlying Rust library was originally written by Daniel Seiler (Xiphoseer, [email protected]), who designed and implemented the document model, transform pipeline, and runtime schema system. Currently maintained by Johannes Wilm (FidusWriter, [email protected]).

ProseMirror is by Marijn Haverbeke and contributors — see prosemirror.net.

License

MIT — see LICENSE.

Copyright 2026 Johannes Wilm Copyright 2020 Daniel Seiler Copyright 2015–2026 Marijn Haverbeke and others