harper Documentation

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy harper on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name harper -p 3306:3306 --restart always mariadb:lts
Configured Services & Ports
โš™๏ธ db
image: mariadb:lts
๐Ÿ”Œ Ports: 3306:3306
docker-compose.yml
yaml (docker-compose.yml)
# This Docker compose file is for development of the Harper website and web services.
# You do not need it to use Harper.

services:
  db:
    image: mariadb:lts
    restart: always
    environment:
      MARIADB_ROOT_PASSWORD: password
      MARIADB_DATABASE: harper
      MARIADB_USER: devuser
      MARIADB_PASSWORD: password
    ports:
      - "3306:3306"
    volumes:
      - ./mariadb_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
      interval: 5s
      timeout: 5s
      retries: 10

File: README.md




Harper is an English grammar checker designed to be just right.
I created it after years of dealing with the shortcomings of the competition.

Grammarly was too expensive and too overbearing.
Its suggestions lacked context, and were often just plain wrong.
Not to mention: it's a privacy nightmare.
Everything you write with Grammarly is sent to their servers.
Their privacy policy claims they don't sell the data, but that doesn't mean they don't use it to train large language models and god knows what else.
Not only that, but the round-trip-time of the network request makes revising your work all the more tedious.

LanguageTool is great, if you have gigabytes of RAM to spare and are willing to download the ~16GB n-gram dataset.
Besides the memory requirements, I found LanguageTool too slow: it would take several seconds to lint even a moderate-size document.

That's why I created Harper: it is the grammar checker that fits my needs.
Not only does it take milliseconds to lint a document, take less than 1/50th of LanguageTool's memory footprint,
but it is also completely private.

Harper is even small enough to load via WebAssembly.

Language Support

Harper currently only supports English, but the core is extensible to support other languages, so we welcome contributions that allow for other language support.

Performance Issues

We consider long lint times bugs.
If you encounter any significant performance issues, please create an issue on the topic.

If you find a fix to any performance issue, we would appreciate the contribution.
Just please make sure to read our contribution guidelines first.

Huge Thanks

This project would not be possible without the hard work from those who contribute.

Harper's logo was designed by Lukas Werner.


File: harper-cli/README.md

`harper-cli`

What?

harper-cli is a small, experimental frontend for Harper.
It can be used in any situation where you might need to check a large number of files automatically (like in continuous integration).

Right now it is quite feature barren, mainly because an external use-case has not been defined yet.
If you have any thoughts, feel free to reach out.

Possible Future Features

  • On-disk caching
  • Custom dictionaries (maybe use the same ones as harper-ls?)
  • Machine-readable output

File: harper-comments/README.md

`harper-comments`

This crate holds a number of functions, but it is primarily a wrapper around tree-sitter that allows Harper to locate the comments of a wide variety of programming languages.
It also has purpose-built parsers for the structured comments of a number of languages, including Go.
These additional parsers are available through the CommentParser and are enabled automatically through there.


File: harper-core/README.md

`harper-core`

harper-core is the fundamental engine behind Harper, the private grammar checker.

harper-core is available on crates.io to enable Rust engineers to integrate high-quality grammar checking directly into their apps and workflows.
Feel free to use harper-core in your projects.
If you run into problems with the code, open an issue or, even better, create a pull request.
We are also happy to chat with you on Discord.

The documentation for harper-core is available online.

If you would prefer to run Harper from inside a JavaScript runtime, we have a package for that as well.

Example

Here's what a full end-to-end linting pipeline could look like using harper-core.

rust
use harper_core::linting::{LintGroup, Linter};
use harper_core::parsers::PlainEnglish;
use harper_core::spell::FstDictionary;
use harper_core::{Dialect, Document};

let text = "This is an test.";
let parser = PlainEnglish;

let document = Document::new_curated(text, &parser);

let dict = FstDictionary::curated();
let mut linter = LintGroup::new_curated(dict, Dialect::American);

let lints = linter.lint(&document);

for lint in lints {
    println!("{:?}", lint);
}

Features

concurrent: Whether to use thread-safe primitives (Arc vs Rc). Disabled by default.
It is not recommended unless you need thread safety (i.e. you want to use something like tokio).

Other Relevant Packages


File: harper-ls/README.md

`harper-ls`

Documentation for harper-ls has moved to the main website.


File: harper-stats/README.md

`harper-stats`

This crate contains the centralized logic for Harper's statistics logging.


File: harper-wasm/README.md

`harper-wasm`

harper-wasm is the WebAssembly-compiled version of the Harper grammar checker.

Currently, the API exists to meet the needs of both the web demo and the Obsidian plugin.


File: packages/wordpress-plugin/README.md

Harper for WordPress

This repository contains the WordPress plugin for Harper.
It is a work-in-progress. Here be dragons!

Contributing

Refer to the online documentation for instructions to contribute to the plugin.


File: packages/web/src/routes/docs/integrations/zed/+page.md


title: Zed

For our Zed integration, we have an extension that automatically downloads and runs harper-ls. For more information on how to install it and how it works, you can head over to the extension's README.


File: packages/web/src/routes/docs/integrations/wordpress/+page.md


title: Harper for WordPress

Harper still works great with WordPress, but the recommended way to use it today is the
Chrome extension.
Read the announcement: The Chrome Extension Supersedes the WordPress Plugin.

The extension is faster to iterate on than the WordPress.com plugin review process, which means you get new
features and fixes right away. It also offers a more holistic experience by keeping your Harper preferences in
sync across the sites where you write.

Install the Chrome Extension

Want to explore the classic workflow? Visit our online demo that runs inside the WordPress Playground.

Go to the Demo

Still using the plugin?

The existing Harper WordPress plugin will stick around, but it no longer receives regular updates and is already a
few months behind the Chrome extension. If you need a manual copy, you can still download harper.zip from
GitHub releases and upload it to your site.