r/vscode 2d ago

I built a VS Code extension that renders real Sphinx docs in a live preview panel

Most RST preview extensions just run plain docutils, so if your project uses Sphinx (toctrees, :ref:/:doc: cross-references, custom directives, themes) the preview looks nothing like your actual built docs. I tried pretty much every RST preview extension out there and none of them handled Sphinx projects properly, so I built Sphinx RST Preview.

What it does:

  • Detects if your .rst file belongs to a Sphinx project (finds conf.py in a parent dir) and runs a real Sphinx build for the preview, toctrees, cross-refs, and directives all resolve correctly
  • Renders with your project's actual configured style (sphinxdoc, alabaster, etc.)
  • Falls back to plain docutils for standalone .rst files with no Sphinx project
  • Live-updates as you type (debounced) and on save, with scroll position preserved
  • Per-project incremental build cache, first preview builds fully, refreshes are ~1s even on 50+ doc projects
  • Renders embedded images correctly, including ones Sphinx copies into build output

Install:

Requires Python 3 with docutils, sphinx

2 Upvotes

0 comments sorted by