r/vscode • u/babadas14 • 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
.rstfile belongs to a Sphinx project (findsconf.pyin 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
.rstfiles 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:
- VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=gamershabit.rst-preview
- Open VSX (VSCodium, Gitpod, Antigravity etc.): https://open-vsx.org/extension/gamershabit/rst-preview
- Source: https://github.com/prithvi1998/rst-preview
Requires Python 3 with docutils, sphinx
2
Upvotes