A modern, immersive, and feature-rich XHTML, HTML, and EPUB reader and live previewer extension for VS Code and compatible IDEs (Antigravity, Cursor, VSCodium).
Whether you are authoring ebooks, inspecting XHTML documents, or reading .epub files directly inside your editor, XHTML Reader Previewer provides a distraction-free, beautifully crafted reading experience with dual reading modes, customizable typography, and instant footnote inspection.
Experience smooth reading, quick TOC search, and instant typography customization in action:
- Open your IDE's extensions pane (
Ctrl+Shift+X/Cmd+Shift+X). - Search for
XHTML Reader Previewer(byselvagant). - Click Install.
Or install directly via CLI:
code --install-extension selvagant.xhtml-reader-previewerDownload the standalone .vsix installer from the Latest GitHub Release.
To install manually:
code --install-extension xhtml-reader-previewer-0.1.0.vsixOr via VS Code UI: Extensions View ➔ Click ... (More Actions) ➔ Install from VSIX... ➔ Select the downloaded file.
Install and activate directly as a native Antigravity 2.0 plugin:
npm run deploy:local-pluginOnce deployed to ~/.gemini/config/plugins/xhtml-reader-plugin, Antigravity exposes:
- Auxiliary Pane Sidecar: Interactive reading panel accessible via pill links
[Buka XHTML Reader](sidecar://xhtml-reader-plugin/xhtml-previewer/). - MCP Server Tools (
xhtml_reader_mcp): Autonomous inspection tools for agents (xhtml_open_preview,xhtml_get_toc,xhtml_get_metadata). - Autonomous Reading Rules: Dedicated agent rule guiding AI assistants to preview publications interactively.
- 📖 EPUB Archive Support (
.epub): Open binary.epubarchives directly with zero manual extraction. Works seamlessly as a Custom Editor or through preview commands. - 📁 EPUB Folder Package Support: Full parsing of extracted EPUB 3 folder packages (
package.opf, nav doc, NCX, and spine sequence). - 🔄 Dual Reading Modes:
- Continuous Scroll: Smooth web-like reading with natural overscroll resistance and gesture-based chapter transitions (Moon+ Reader style).
- Paginated Reader: Clean multi-column book layout with page navigation and smooth pagination.
- 🧭 Table of Contents (TOC) Sidebar: Slide-over drawer with hierarchical navigation and live search filtering.
- 🎨 Customizable Typography & Themes:
- Themes: Dark, Light, and Sepia
- Font families: Serif, Sans-Serif, and Monospace
- Adjust font sizes, line heights, and reading column widths on the fly.
- 📌 Anchored Footnote & Noteref Popovers: Hover or click footnote references (
¹,[1],*) to immediately inspect translation notes, citations, and multilingual explanations in an anchored popover with a precise pointer caret—never losing your reading position. - ⏪ Reading Navigation History Stack: Seamlessly jump to chapters or references and return instantly using the floating return pill or keyboard shortcuts.
- 📑 Canonical EPUB Spine Inspector: Dual-tab sidebar (
ContentsvsSpine Order) adhering strictly to the OPF<spine>sequence withNON-LINEARbadges and rich toolbar metadata. - 💾 Reading Location Persistence: Automatically remembers your exact reading progress, scroll offset, and last opened chapter per book across sessions.
- ⚡ Ultra-Compact Immersive UI: Floating, auto-collapsing toolbar with official Phosphor icons and ghost aesthetics.
| Table of Contents (TOC) Sidebar | Typography & Theme Customization |
|---|---|
![]() |
![]() |
| Anchored Footnote & In-line Annotation Popover |
|---|
![]() |
Right-click any .xhtml, .html, .htm, or .epub file in the Explorer, or click the preview button in the editor title bar:
XHTML Reader: Open PreviewXHTML Reader: Open Split Preview
Double-click any .epub file in your workspace to open it immediately in the dedicated reader view.
| Action | Shortcut / Gesture |
|---|---|
| Next / Previous Page (Paginated) | → / ← or PageDown / PageUp |
| Next / Previous Chapter | ] / [ or Header Navigation Buttons (‹ / ›) |
| Return to Previous Position | Backspace / B / Alt+Left or Floating Return Pill |
| Toggle Table of Contents & Spine | T or Click Contents Button |
| Quick Search TOC | / (focuses TOC search input) |
| Open Settings | S or Click Settings Icon |
| Natural Chapter Scroll Transition | Scroll past top/bottom boundaries (Overscroll) |
The repository features a unified Dual-Target Build Pipeline that generates both the VS Code extension and the Antigravity 2.0 plugin from a shared core:
# Install dependencies
npm install
# Type check
npm run check # Full check
npm run check:core # Pure core check (verifies zero vscode dependency)
# Run test suite (all 67 unit and integration tests)
npm test
# Build all targets (VS Code extension + Antigravity sidecar & MCP)
npm run build:all
# Target 1: VS Code Extension
npm run build:vscode
npm run package:vsix # Outputs standalone lean .vsix package
# Target 2: Antigravity 2.0 Plugin
npm run build:plugin # Builds sidecar-server.cjs & mcp-server.cjs
npm run deploy:local-plugin # Deploys bundle to ~/.gemini/config/plugins/xhtml-reader-plugin- Local Execution: No telemetry, no external network requests, zero remote scripts.
- Strict Content Security Policy (CSP): Dynamic HTML is safely rendered with nonces and sandbox isolation.
- Resource Protection: Path traversal checks and ZIP bomb prevention built into the archive reader.
Distributed under the MIT License.
Copyright (c) 2026 selvagant.






