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-languagetool

v0.1.0

Published

LanguageTool Plugin for ProseMirror

Readme

prosemirror-languagetool

A ProseMirror plugin for grammar and spelling checking using LanguageTool.

Highlights errors with colored wavy underlines (red for misspellings, orange for grammar issues). Optionally shows a popup with correction suggestions that can be applied with a click.

Live Demo

Install

npm install prosemirror-languagetool

Usage

import { EditorState } from "prosemirror-state";
import { EditorView } from "prosemirror-view";
import { schema } from "prosemirror-schema-basic";
import { grammarPlugin } from "prosemirror-languagetool";

const view = new EditorView(document.getElementById("editor"), {
  state: EditorState.create({
    schema,
    plugins: [
      grammarPlugin({
        languageToolCheckURL: "https://api.languagetoolplus.com/v2/check",
        language: "en-US",
      }),
    ],
  }),
});

Include the stylesheet for error decorations:

import "prosemirror-languagetool/style/prosemirror.css";

Or link it directly:

<link rel="stylesheet" href="prosemirror-languagetool/style/prosemirror.css">

Options

| Option | Type | Required | Description | |---|---|---|---| | languageToolCheckURL | string | Yes | URL to the LanguageTool /v2/check endpoint. | | language | string | Yes | Language code (e.g. "en-US", "de-DE"). | | languageToolCheck | (text: string, language: string) => Promise<CheckResponse> | No | Custom check function. Overrides the default HTTP request. | | actionPopup | boolean | No | Enable a click-to-fix popup on highlighted errors. Defaults to false. |

Action popup

When actionPopup is enabled, clicking on a highlighted error shows a popup with the error message and up to 5 replacement suggestions. Clicking a suggestion applies the fix. The popup dismisses on click outside or pressing Escape.

grammarPlugin({
  languageToolCheckURL: "https://api.languagetoolplus.com/v2/check",
  language: "en-US",
  actionPopup: true,
});

Custom check function

You can provide a languageToolCheck function to control how the API is called (e.g. to route requests through a proxy or add authentication):

grammarPlugin({
  languageToolCheckURL: "https://api.languagetoolplus.com/v2/check",
  language: "en-US",
  languageToolCheck: async (text, language) => {
    const resp = await fetch("/api/grammar-check", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ text, language }),
    });
    return resp.json();
  },
});

The function must return a promise that resolves to a CheckResponse object matching the LanguageTool API response format.

Styling

The plugin applies CSS classes to decorated text:

| Class | Used for | |---|---| | ProseMirror-grammar-red | Misspellings | | ProseMirror-grammar-orange | Grammar issues |

The default stylesheet renders these as colored wavy underlines. You can override the styles to customize the appearance.

Behavior

  • Linting is debounced by 1 second after the last edit.
  • In-flight requests are aborted when a new check is triggered.
  • Code blocks are excluded from linting.
  • The browser's built-in spellcheck is disabled on the editor to avoid duplicate annotations.

API

grammarPlugin(options: PluginOptions): Plugin

Creates and returns a ProseMirror plugin.

CheckResponse

TypeScript type for the LanguageTool API response. Re-exported for use with the languageToolCheck option.

License

BSD-3-Clause