Blue Pencil Marginalia

unlisted

by Doug Langille

Marks parts of speech and mechanical writing signals beside your text. Offline, no inference, never rewrites.

Updated 1mo agoMIT
View on GitHub

Blue Pencil Marginalia

Marks spelling, grammar and mechanical writing signals beside your text in Obsidian, like notes in a margin. It never rewrites anything unless you tap a suggestion, and it uses no AI. Everything is word lists, patterns and counting, plus an offline spelling and grammar checker you can add.

A mark is a signal, not a verdict. One instance of most patterns means little. A pattern shows up only when this note is above your own usual rate (or, before you build your usual range, at 3 or more hits). You decide what stays.

What you get

Three kinds of mark, in the editor:

  • Red wavy underline: spelling.
  • Green dashed underline: grammar and usage.
  • Blue highlight: everything an editor would raise, from the checks below.

Click a mark for a card with what it says and up to five suggestions (replace, delete or insert). Spelling also offers Add to dictionary, and spelling and grammar offer Ignore.

The Proof panel (sidebar) holds a chip for each category, one chip per blue check the note has marks for (grouped as Rhythm, Flow, Structure, Words, Dialogue, Detail and Proofreader), and a list of every mark with its suggestions. Tap a chip to hide or show that check. Click a row to jump to the mark.

Marks are off until you turn a category on: tap a chip in the panel. The ribbon icon (a highlighter) and the command "Turn marks on or off" switch all three off, or back to what was on. With every category off, nothing runs. Every check runs in every note, with no essay or story switch, so a check that doesn't fit your piece simply doesn't fire.

Your usual range. In Settings, point it at folders of your finished essays and stories. It measures them once, and a pattern then shows only when the open note is above your usual rate. It picks the essay or story range by reading the note.

Spelling and grammar

These need Harper (Apache-2.0), an offline checker that is about 20 MB. It is not bundled. In Settings, press Download once: it fetches the file from cdn.jsdelivr.net, checks it against a fixed checksum and saves it in the plugin folder. That button is the only time Blue Pencil touches the network, and nothing runs until you press it. Without it you still get the blue marks and a short list of common slips (its/it's, could of).

American spelling is the default, since Canadian or British would flag American usage. Pick yours in Settings. Words you add live in a text file you name in Settings (one word per line, so a vault can share it across devices), or inside the plugin if you leave that blank.

Command line

node cli.cjs <file> [--mode=essay|story|auto] [--examples=4] [--strict] [--json] prints the engine's analysis as a markdown report: em dash and semicolon rate, numbers outside your usual range, and signals above your usual rate with line-numbered examples. --strict turns the dash and semicolon rate into a pass/fail check, for drafts you want held to a no-dash, no-semicolon rule. --json prints the same data, with every flagged span, for other tools.

node cli.cjs --build-profile=essay|story <folder> measures a folder of your finished writing and saves profile-<kind>.json beside the CLI, so the report can show your usual range. The CLI needs no build step. No network, no AI.

Install

With BRAT: add douglangille/blue-pencil-marginalia as a beta plugin.

By hand: download main.js, manifest.json and styles.css from the latest release into <your vault>/.obsidian/plugins/blue-pencil-marginalia/, then enable Blue Pencil Marginalia under Community plugins.

From source: clone the repo into <your vault>/.obsidian/plugins/blue-pencil-marginalia/ (or symlink it there) and run sh build.sh.

Desktop only for now. English only. Upgrading from 0.9: the old tabbed panel, per-check colors, essay/story switch, Syntax coloring and map are gone, replaced by the three marks and the Proof panel.

Honest limits

  • Part-of-speech tagging uses compromise, which is fast and offline but not perfect. Some words will be mislabeled.
  • The built-in cutoffs (a long sentence is 25+ words, for example) are rules of thumb. The "usual range" feature is there so you can compare against your own writing instead.
  • Picking the essay or story range needs both folders built. With only one, or none, a pattern shows at 3 or more hits.
  • Several checks are proxies. "Topic jump" asks whether a sentence shares any word with the one before it, which is a rough stand-in for flow. Treat every mark as a prompt to look, not a defect.

Develop

The analysis lives in engine/ and has no Obsidian or editor dependency: analyze.js (hits, counts, stats), rules.js (phrase rules), registry.js (every check's tab, label, color and help, plus its category), profile.js (usual ranges), report.js (the headless report). The CLI, the plugin and other tools all require it. proof.js turns it into the marks a surface shows (three categories, explanations, suggestions) and is shared with the Forge app. src/ is Obsidian only: plugin.js (panel, card, settings), marks.js (the editor decorations) and harper.js (the download and the checker).

main.js is generated: sh build.sh bundles src/, engine/, vendor/compromise.js and harper.js's JavaScript with esbuild (installed on first run). node test/run.cjs runs the engine tests directly, with nothing stubbed.

Credits and license

MIT, see LICENSE. Part-of-speech tagging by compromise 14.18.0 (MIT, license in vendor/). Spelling and grammar by Harper (Apache-2.0). Cutoffs draw on GOV.UK plain-language guidance and the Plain English Campaign.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.