Software Consulting & Engineering Requirements to Production

cargo-spellcheck: source-aware documentation checks

2021-present

← Back to portfolio

  • Open source
  • Rust
  • CommonMark
  • Spellchecking

Developing and maintaining cargo-spellcheck, which I created to bring spelling and grammar checks into Rust documentation workflows. Documentation comments and CommonMark documents need checks that understand their structure, report the original source location, and accommodate a project's technical vocabulary.

The extraction layer groups documentation fragments into checkable text while retaining a mapping to source spans. That mapping connects suggestions back to the comments or Markdown they came from, supporting source-located diagnostics and interactive corrections. Hunspell provides dictionary-based spelling checks, while nlprule supplies grammar rules derived from LanguageTool.

Project configuration controls checker behavior and adds dictionaries for domain-specific terms. Built-in dictionaries can give local and CI runs consistent inputs across operating-system distributions. Interactive fixing, commit hooks, and configurable failure exit codes let teams introduce checks locally and later enforce them in CI. The parser, diagnostic mapping, and automation are parts of the same tool: a useful suggestion must reach the right source location and fit the workflow in which documentation is reviewed.