blog.dopana

Back

Grammarly is expensive, sends everything you write to their servers, and often gives context-free suggestions that are just plain wrong. LanguageTool works, but it needs gigabytes of RAM and a ~16GB n-gram dataset — and takes seconds to lint even a moderate document.

Harper was created to fix all of that. It’s a grammar checker that runs entirely offline and privacy-first, lints documents in milliseconds, uses less than 1/50th of LanguageTool’s memory footprint, and is even small enough to run via WebAssembly.

What is Harper?#

Harper is an open-source English grammar checker built in Rust by Automattic. It’s designed around a simple philosophy: it should be just right — fast enough to never interrupt your flow, private enough that your writing never leaves your machine, and small enough to run anywhere.

Why Harper?#

Blazing Fast#

Harper lints documents in ~10 milliseconds on average, compared to ~400ms–4000ms for cloud-based alternatives. Lint times are so important to the project that they consider long lint times to be bugs.

Privacy-First & Offline#

Zero telemetry. Zero cloud transmission. Everything runs locally on your device. This makes Harper ideal for journalists, legal professionals, and enterprises working with sensitive documents that can’t be sent to third-party servers.

Tiny Memory Footprint#

Harper uses less than 1/50th of LanguageTool’s memory — no gigabytes of RAM, no 16GB n-gram datasets to download.

WebAssembly-Ready#

Harper is small enough to compile to WebAssembly, which means it runs in web browsers and browser extensions — grammar checking anywhere, without any server.

Language Support#

English Dialects#

Harper supports multiple English dialects:

  • American English
  • British English
  • Canadian English
  • Australian English
  • Indian English

Host Languages (Comments & Docs)#

While the grammar engine checks English, harper-ls parses and lints comments and documentation across dozens of programming and markup languages:

  • Markup: Markdown, AsciiDoc, Org Mode, LaTeX/TeX, HTML, Email/Plain Text
  • Programming (comments): C, C++, C#, Go, Rust, Python, JavaScript, TypeScript, Java, Ruby, PHP, Swift, Kotlin, Lua, Bash/Shell, Haskell, Scala, Zig, TOML, YAML, and more

Installation#

# macOS / Linux
brew install harper

# Windows
scoop install harper

# Arch Linux
sudo pacman -S harper

# Nix
nix shell 'nixpkgs#harper'

# Rust
cargo install harper-ls --locked
bash

Editor Integrations#

Harper has official plugins for:

  • Visual Studio Code
  • Neovim
  • Helix
  • Emacs
  • Obsidian
  • Zed
  • Sublime Text
  • Chrome & Firefox browser extensions

Architecture#

The Harper monorepo has three main components:

ComponentRole
harper-coreThe core Rust library — tokenizes, parses, analyzes, and lints text
harper-lsA Language Server Protocol (LSP) server that connects the core engine to editors and IDEs
harper.js / harper-wasmJavaScript/TypeScript bindings that package the engine via WebAssembly for browsers and Node.js

harper-core Pipeline#

  1. Document — structured representation of text
  2. Parser — lexes English and host languages (like Markdown) into token streams
  3. Linter — traits that inspect documents and produce zero or more error Lints

Key Features#

Granular Dictionaries#

Support for user-level, workspace-level, file-local, and built-in static dictionaries — so you can manage your own vocabulary at every scope.

Code Actions & Quick Fixes#

Built-in IDE code actions let you:

  • Replace mistakes with suggestions
  • Ignore lints for the current session
  • Add words to custom dictionaries

Comment Ignorance#

Harper respects comment-skipping tags like // harper:ignore and spellchecker:ignore, so it coexists peacefully with tools like CSpell.

Custom Rules via Weir#

Write your own grammar and style rules using Weir, Harper’s custom expression language. Organizations can bundle rules into Weirpacks (zipped .weir files) to enforce brand naming conventions, proprietary terminology, and team-specific writing guidelines.

Use Cases#

Privacy-conscious writing — Journalists, legal teams, and enterprises that handle sensitive data and can’t risk sending documents to cloud grammar checkers.

Developer documentation — Write clean READMEs, code comments, and Markdown docs directly in your IDE with instant feedback.

Enterprise style guides — Enforce proprietary terminology and brand conventions automatically with custom Weir rules.

On-the-web checking — The WebAssembly build means grammar checking works in browsers and extensions, offline, with no server.

Summary#

Harper takes the best of what grammar checkers should be: fast, private, and open. It’s the grammar checker that fits — whether you’re a developer writing docs, a journalist protecting sources, or an enterprise enforcing brand voice.

Rust-powered, WebAssembly-ready, Apache 2.0 licensed, and completely offline — Harper is a modern grammar checker that respects your privacy and your time.

References#