reStructuredText Preview Troubleshooting
This guide helps you resolve common issues with reStructuredText preview functionality in VS Code.
Common Issues and Solutions
Problem: The preview commands don’t appear in the command palette.
Solutions:
Install Required Extensions: - Install lextudio.restructuredtext (reStructuredText extension) - Install swyddfa.esbonio (Esbonio language server)
Reload VS Code: - Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type “Developer: Reload Window” - Press EnterCheck File Association: - Ensure .rst files are associated with reStructuredText - Open a .rst file and check the language mode in the bottom right
Problem: Commands appear but don’t generate preview.
Solutions:
Check Python Dependencies:
`bash cd docs pip install -r requirements.txt `Verify Sphinx Configuration: - Ensure docs/conf.py exists and is valid - Check that docs/Makefile exists
Test Build Manually:
`bash cd docs make html `
Problem: Esbonio language server fails to start.
Solutions:
Check VS Code Settings: ```json {
“esbonio.server.enabled”: true, “esbonio.sphinx.confDir”: “${workspaceFolder}/docs”, “esbonio.sphinx.buildDir”: “${workspaceFolder}/_build/html”, “esbonio.sphinx.srcDir”: “${workspaceFolder}/docs”
Check Output Panel: - Open Output panel (View → Output) - Select “Esbonio” from dropdown - Look for error messages
Restart Esbonio Server: - Press
Ctrl+Shift+P- Type “Esbonio: Restart Server” - Press Enter
Problem: Preview works but shows build errors.
Solutions:
Fix RST Syntax Errors: - Check for missing colons after directives - Verify proper indentation - Fix broken links and references
Check Image Paths: - Ensure images exist in the specified paths - Use relative paths from the docs directory
Update Dependencies:
`bash pip install --upgrade sphinx docutils sphinx_rtd_theme `
Step-by-Step Verification
Verify Extensions:
`bash code --list-extensions | grep -E "(restructured|esbonio)" `Check File Recognition: - Open any .rst file - Look at bottom-right corner for language mode - Should show “reStructuredText”
Test Command Palette: - Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type “reStructuredText” - Should see multiple options including:“reStructuredText: Preview Sphinx”
“reStructuredText: Preview Docutils”
“reStructuredText: Build Sphinx”
Check Output Panel: - View → Output - Select “Esbonio” from dropdown - Look for any error messages
Test Manual Build:
`bash cd docs make html `
Alternative Preview Methods
If the VS Code preview doesn’t work, you can:
Use Browser Preview:
`bash cd docs make html # Open _build/html/index.html in browser `Use Live Server: - Install Live Server extension - Right-click on _build/html/index.html - Select “Open with Live Server”
Use Python HTTP Server:
`bash cd docs/_build/html python -m http.server 8000 # Open http://localhost:8000 in browser `
Getting Help
If you’re still having issues:
Check Extension Logs: - Help → Toggle Developer Tools - Look for errors in Console tab
Report Issues: - reStructuredText Extension: https://github.com/vscode-restructuredtext/vscode-restructuredtext - Esbonio: https://github.com/swyddfa/esbonio
Community Support: - Stack Overflow: Tag questions with restructuredtext and vscode - GitHub Discussions: Check extension repositories
This troubleshooting guide should help resolve most common preview issues.