Skip to content

Auto-Fixers

Some Inspect findings include an auto-fix option. When available, Synapse can automatically transform your template HTML to resolve the issue, producing a corrected version and a reverse patch for undo.


How Auto-Fix Works

  1. Run an inspect -- trigger a Quick Check or Full Inspect on your template
  2. Review findings -- findings with auto-fix available are marked in the results
  3. Apply the fix -- the auto-fixer modifies the template AST to resolve the issue
  4. Undo if needed -- every auto-fix produces a reverse patch, so you can revert the change

Auto-fixes are applied to the template's structured AST (V2 templates), not raw HTML strings. This ensures changes are precise and reversible.


Currently Supported Auto-Fixers

Finding CodeWhat It Fixes
HTML_MISSING_DOCTYPEAdds <!DOCTYPE html> declaration
HTML_MISSING_CHARSETAdds <meta charset="utf-8"> to <head>
HTML_MISSING_LANGAdds lang="en" to the <html> tag
HTML_MISSING_VIEWPORTAdds viewport meta tag to <head>
HTML_MISSING_TITLEAdds a <title> tag to <head>
DARK_MODE_NO_METAAdds color-scheme meta tag
DARK_MODE_NO_CSS_SCHEMEAdds supported-color-schemes meta tag
DM005Adds MSO dark-mode override conditional
DARK_MODE_HARDCODED_BGDefines a dark-mode CSS variant for hardcoded backgrounds
DARK_MODE_HARDCODED_TEXTDefines a dark-mode CSS variant for hardcoded text colors
DARK_MODE_LOGO_NO_SWAPAdds dark-mode logo image swap markup

Limitations

  • Auto-fixers only work with V2 templates (templates stored with body_ast). V1 templates must be manually fixed.
  • Not all findings are auto-fixable. Complex issues like invalid HTML nesting or spam keyword density require manual intervention.
  • Auto-fixes are best-effort -- always review the result before sending.
Note

The auto-fix registry is extensible. New fixers are added as the findings catalog grows.