redink 0.1.10

A spellchecker for prose — a TUI for humans, a JSON CLI for agents
redink-0.1.10 is not a library.

redink

A spellchecker for prose — a terminal UI for humans and a JSON CLI for agents.

Redink is built for long-form writing (novels, manuscripts). It pairs a vetted system dictionary with a per-project working dictionary that lives in your repository, so coinages, names, and foreign phrases travel with the text. It's smart about the things prose actually trips on: possessives of coinages, hyphenated compounds, short Latin phrases, and Markdown.

Dictionary model

  • System dictionary: the bundled SCOWL en_US (size 60, version 2020.12.07), embedded in the binary so redink works with nothing installed. If a system en_US.{aff,dic} is present it is preferred (so --lang en_GB etc. work); see --sysdict-dir.
  • Working dictionary: .redink.dic in your repo (found by searching from the current directory upward). All additions go here and only here — the system dictionary is never modified. Plain-text, one entry per line, git-friendly.

The working dictionary format:

# bare word      -> case-insensitive (accepted in any case)
# =Word          -> case-sensitive   (accepted only in that exact casing)
# multi-word line -> phrase          (matched as bigrams against neighbours)
# =Multi Word    -> phrase, exact casing only
hobbit
=Gondor
per se
=Tzeya Gan

Build

cargo build --release
# binary: target/release/redink

Usage

redink src/chapter.*.md      # TUI over those files (interactive terminal)
redink                        # TUI over all .md/.txt in the cwd
redink check                  # non-interactive check (text output)
redink check chapters/        # check a whole directory tree
redink check --json ch01.md   # machine-readable, for scripts/agents
redink check --words          # just the unique misspelled words
redink dict list              # show the working dictionary
redink dict add hobbit Gondor # add case-insensitive words
redink dict add --sensitive Gondor   # add exact-case entry
redink dict add "per se"      # add a phrase (multi-word argument)
redink dict add --sensitive "Tzeya Gan"  # add an exact-case phrase
redink dict remove hobbit
redink fix ch01.md --at 1234 --word brwon --to brown   # replace at a byte offset

Global options: --dict <PATH>, --lang <LANG> (default en_US), --sysdict-dir <DIR>, --format <auto|markdown|text> (default auto; md is accepted as a shorthand for markdown).

Paths may be files or directories; a directory is walked for .md/.txt, honoring .gitignore. A file named explicitly is checked whatever its extension. With no paths at all, redink walks the current directory.

A bare redink <files> launches the TUI when stdout is a terminal, otherwise runs a non-interactive check.

Exit codes: 0 clean · 1 misspellings found · 2 error. A file that could not be read counts as an error, so 0 never hides a mistyped path.

JSON schema (check --json)

An array of objects, one per occurrence:

{
  "file": "ch01.md",
  "line": 42,
  "column": 13,
  "byte_offset": 1234,
  "word": "teh",
  "suggestions": ["the", "tech"],
  "compound": null
}

byte_offset is absolute and word is the exact bytes at that offset, so a precise, unambiguous replacement is redink fix <file> --at <byte_offset> --word <word> --to <replacement>. compound carries the whole hyphenated token when the misspelling is one part of a compound, otherwise null.

TUI keys

key action
j k n N move between misspellings
1–9 replace with the Nth suggestion
r type a replacement (Enter/Esc)
i ignore this word for the session (case-insensitive, not persisted)
a add the word, case-insensitive (any case)
A add the word, exact case
h add the whole hyphenated compound, case-insensitive
H add the whole hyphenated compound, exact case
p add a word or phrase at a prompt (= toggles exact case, Enter/Esc)
s save edited files · q save + quit · Q / Ctrl-C discard + quit · ? help

The misspelling is shown in context (a character window centered on the word), highlighted, with numbered suggestions.

How it handles prose

  • Possessives of coinages. Add the base form and the possessive comes free: adding Bill accepts Bill's too. Adding via the possessive (Atrax's) registers the stem (Atrax). Works for ASCII and Unicode (') apostrophes.

  • Hyphenated compounds. Tzeya-Gan is checked whole first; if nothing recognizes it, each part is checked, and only the bad part is flagged (so recieve-bar flags recieve, leaves bar). Add a compound with h/H or dict add Tzeya-Gan to accept it as a unit. -- em-dashes split cleanly.

  • Phrases. per se, de facto, a priori, in vitro, ad hoc, … are recognized as units (43 common Latin phrases bundled; add your own as multi-word lines, or =Multi Word / --sensitive for exact casing). The fragment words are accepted only in the phrase, so a standalone se is still flagged.

  • Markdown. Fenced/inline code, bare URLs, YAML frontmatter, and HTML comments/tags are skipped. Override per-file with --format.

  • In-file directives (Markdown only). HTML comments, so they vanish from pandoc output:

    • <!-- redink:off --> … <!-- redink:on --> skips a passage — between blocks, or mid-sentence: She said <!-- redink:off -->"Ze vorld"<!-- redink:on -->. Either marker may carry an optional reason, echoed in any warning about it: <!-- redink:off Kesh's dialect -->.
    • <!-- redink:allow vorld =Kesh --> accepts those words anywhere in the file (bare = any case, =Word = exact case, possessives free), without switching off checking for the surrounding prose.

    An off with no on skips to end of file and warns — on stderr, and in an alert when the TUI opens. Stray ons, typo'd directives (redink:of), and empty allows warn on stderr; warnings never change the exit code. Directives inside code are inert. --no-ignore disregards them all, for auditing what they hide.

  • Suggestions. System-dictionary candidates arrive in that dictionary's own ranking and keep it. Working-dictionary entries are then merged into the list at the position their closeness to the flagged word earns — Damerau- Levenshtein, so a transposition counts as one slip — rather than being pinned to the front. A coinage that is genuinely the likely intent leads; one that is merely present in the project sinks to where it belongs. Exact ties go to the working dictionary, on the grounds that a word the author wrote down is the better guess between two equally close candidates. Candidates shorter than 3 characters are dropped as noise.

Credit & license

The bundled English dictionary is derived from SCOWL © 2000–2026 Kevin Atkinson and others (permissive; see assets/dict/en_US-COPYRIGHT), with the affix file from Geoff Kuenning's ispell (BSD). Local fixes are kept as a build-time patch manifest (assets/dict/en_US.patches); see "Local modifications" in that file.