Add spelling and grammar proofing

Connect a spelling or grammar provider to SuperDoc.

Proofing helps people catch spelling and grammar mistakes while they write, before those mistakes reach a reader. Word processors usually underline an issue so the writer can replace or ignore it without leaving the document.

Try proofingType “mispelled”, “workng”, or “teh”, then right-click its underline.
Loading…

The proofing editor is loading.

Enable proofing

SuperDoc schedules checks, underlines issues, and handles Ignore and replacements. It does not include a dictionary or grammar checker, so you provide one:

import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';

const superdoc = new SuperDoc({
  selector: '#editor',
  document: '/contract.docx',
  proofing: {
    enabled: true,
    provider: {
      id: 'local-example',
      check: async ({ segments }) => ({
        issues: segments.flatMap((segment) => {
          const start = segment.text.indexOf('teh');
          return start < 0
            ? []
            : [{ segmentId: segment.id, start, end: start + 3, kind: 'spelling', replacements: ['the'] }];
        }),
      }),
    },
  },
});

window.addEventListener('beforeunload', () => superdoc.destroy());

This provider flags only teh. For a complete local dictionary, see the proofing example.

SuperDoc sends text segments to the provider after edits. Return spelling, grammar, or style issues with zero-based UTF-16 offsets. Honor the request's signal so SuperDoc can cancel stale or timed-out checks.

Configure proofing

Start with Setup, then open the other groups only when you need them. Proofing runs only when both enabled: true and provider are present.

ProofingConfig
proofing: {
}
required for feature
enabled

Enables proofing. A provider is also required before SuperDoc runs checks.

Type
boolean
Default
false

13 fields · generated from ProofingConfig

Options under Reserved are present in the TypeScript type but do not affect the current runtime.

Protect document text

If the provider uses a network, document text leaves the browser. Obtain user consent, send only the required segments over authenticated encrypted transport, define how the service retains and deletes the text, and never include document text in URLs or logs.

On this page