For code we have linters that catch every missing semicolon. For prose, most people still rely on "I'll give it a quick read later." I use two tools side by side to check my writing, and each one does something different.
LanguageTool: spelling and grammar
LanguageTool is an open-source grammar and style checker that supports English and many other languages. You can use the browser extension, but if you write in your editor it's nicer to have it right there.
In VS Code you can do that with the LTeX+ extension, which uses LanguageTool for Markdown, LaTeX and other formats. Set the language in your settings:
{
"ltex.language": "en-US"
}
If you'd rather use LanguageTool from a script, there's an HTTP API:
curl -s https://api.languagetool.org/v2/check \
-d language=en-US \
--data-urlencode "text=This sentence contain a mistake that get caught."
You get JSON back with the issues it found and suggested fixes. Keep in mind that the free public API has limits. For large amounts of text, or anything confidential, you can also run LanguageTool locally; the standalone version includes its own HTTP server.
Vale: your own style rules
LanguageTool checks whether something is correct. Vale checks whether it fits your style. Vale is an open-source command-line prose linter. You write rules in YAML and Vale runs them over your Markdown files.
You can install existing style packages, but writing your own rules is easy. A minimal .vale.ini:
StylesPath = styles
MinAlertLevel = suggestion
[*.md]
BasedOnStyles = Vale, MyStyle
And a rule in styles/MyStyle/Wordy.yml to catch stiff, wordy phrases:
extends: substitution
message: "Consider using '%s' instead of '%s'."
level: warning
ignorecase: true
swap:
utilize: use
in order to: to
prior to: before
in the event that: if
Run it:
vale article.md
Vale points out, line by line, where your text breaks your own rules. It's also easy to add to a CI pipeline, so the documentation in a repo keeps a consistent style.
Why use both
LanguageTool catches the "contain/contains" slips. Vale enforces the choices you made yourself: no corporate filler words, consistent spelling of product names, no "click here." Together they save a whole round of proofreading.
What's in your prose-linting setup? I'd love to hear which Vale rules other people swear by.
Top comments (0)