Antigravity Preview Studio
by DaDerekkk
README.md
# Antigravity Preview Studio
[](https://github.com/DaDerekkk/antigravity-preview-studio/actions/workflows/ci.yml)
[](LICENSE)

A zero-CDN, native **Antigravity MCP App** plugin for viewing, inspecting, and editing **HTML, Markdown, LaTeX, Mermaid, SVG, CSV/TSV, JSON/JSONL, Word, Excel, and PowerPoint** files and URLs inside Antigravity with instant **Preview | Split | Code** switching.
---
## Feature Matrix
| Capability | Details |
| --- | --- |
| **View Modes** | `Preview`, `Split` (resizable), and `Code` powered by **CodeMirror 6** |
| **Zero-CDN Offline Bundle** | Everything—including KaTeX `.woff2` fonts, Mermaid, Marked, Highlight.js, and CodeMirror—bundles into a single self-contained `dist/app.html` |
| **Bidirectional Editing** | Toggle Markdown checkboxes, insert Math/Unicode symbols (`Ω`), edit CSV/XLSX cells & rows, or click HTML elements in Inspect mode to jump to source |
| **Native "Open With" Launcher** | One-click jump to **Microsoft Word, Excel, PowerPoint, Chrome, Cursor, Pages, Finder**, or system default app even from `antigravity-file://` tabs |
| **Context Micro-Toolbars** | Format-specific quick actions (viewports, console, snippets, symbol picker, outline drawer, zoom, background, charts, tree/table, format/minify) |
| **Local & Remote Loading** | Opens `antigravity-file://` resources, local file paths, `file://` URIs, `http(s)://` URLs, and pasted inline snippets |
| **Asset Resolution** | Inlines relative local CSS, JS, images, and fonts (up to 4 MiB) for local HTML and Markdown documents |
| **Export & Print** | Export standalone `.html`, vector `.svg`, rasterized `.png`, or print to PDF |
| **Native Theme Sync** | Automatically follows Antigravity light/dark theme and CSS host variables |
---
## Supported Formats
| Format | Extensions | Highlights |
| --- | --- | --- |
| **HTML** | `.html`, `.htm` | Sandboxed iframe, `Desktop / Tablet / Mobile` viewports, live `Console` capture, click-to-source `Inspect`, `localStorage` shim, relative link navigation |
| **Markdown** | `.md`, `.markdown`, `.mdx` | GFM tables, Highlight.js syntax highlighting, KaTeX math (`$` / `$$`), embedded Mermaid diagrams, interactive checkboxes, collapsible Outline |
| **LaTeX** | `.tex`, `.latex` | Sections, `\begin{equation}` / `\begin{align}`, matrices, fractions, theorems/lemmas/proofs, KaTeX math rendering, collapsible Outline |
| **Mermaid** | `.mmd`, `.mermaid` | Flowcharts, sequence, state, class, ER, and Gantt diagrams with zoom/fit controls and Checker/Light/Dark canvas |
| **SVG** | `.svg` | Crisp vector stage with zoom/fit controls, Checker/Light/Dark background toggle, and PNG/SVG export |
| **CSV / TSV** | `.csv`, `.tsv` | Sortable/filterable interactive table, inline cell editing, `+ Row` insertion, and automatic SVG bar/line chart view |
| **JSON / JSONL** | `.json`, `.jsonl` | Collapsible interactive JSON tree, auto-detected array-of-objects table view, one-click `Format` and `Minify` |
| **Word** | `.docx` | Clean document reader, heading outline, optional inline `contenteditable` editing, Print & standalone HTML export |
| **Excel** | `.xlsx`, `.xls` | Multi-sheet tabs, sortable/searchable grid, double-click cell editing, `+ Row` / `Delete Row` with `.xlsx` save-back, and SVG charts |
| **PowerPoint** | `.pptx` | 16:9 slide deck viewer, thumbnail rail, `←` / `→` navigation, Grid Overview, Speaker Notes, and HTML export |
---
## Keyboard Shortcuts
| Shortcut | Action |
| --- | --- |
| `Cmd/Ctrl + S` | Save current writable file (`antigravity-file://` or local path) |
| `Cmd/Ctrl + Shift + V` | Toggle between **Preview** and **Code** mode |
| `Cmd/Ctrl + \` | Toggle **Split** mode |
| `Cmd/Ctrl + F` | Find / replace inside CodeMirror editor |
---
## Installation in Antigravity
### From Source
```bash
git clone https://github.com/DaDerekkk/antigravity-preview-studio.git
cd antigravity-preview-studio
npm install
npx tsc --noEmit
npm run build
npm test
npm run install:plugin
```
`npm run install:plugin` copies the built plugin (`plugin.json`, `mcp_config.json`, `assets/`, `bin/`, and `dist/`) into `~/.gemini/config/plugins/html-viewer`.
### Usage
- **Open any supported file** directly in Antigravity—Preview Studio registers as the custom viewer (`view_html_file`) for `.html`, `.htm`, `.svg`, `.md`, `.markdown`, `.mdx`, `.tex`, `.latex`, `.mmd`, `.mermaid`, `.csv`, `.tsv`, `.json`, `.jsonl`, `.docx`, `.xlsx`, `.xls`, and `.pptx`.
- **Ask Antigravity**:
- *"Open `examples/demo.md` in Preview Studio"*
- *"Preview `https://example.com` in Split mode"*
- *"Open Preview Studio in the side pane"*
---
## Architecture Overview
```text
antigravity-preview-studio/
├── src/
│ ├── types.ts # Shared DocFormat, LoadedDocument & format detection
│ ├── server/
│ │ ├── index.ts # MCP stdio server & tool/resource handlers
│ │ ├── loader.ts # Local/URL loading, asset inlining & preview bridge
│ │ ├── office.ts # Pure-JS DOCX, XLSX/XLS, and PPTX parsers/serializers
│ │ └── openWith.ts # Native macOS/Windows/Linux Open With & Finder launcher
│ └── ui/
│ ├── template.html # App shell HTML template
│ ├── styles.css # Native light/dark styling & renderer typography
│ ├── app.ts # Controller, toolbars, symbol picker, sync & export
│ ├── editor.ts # CodeMirror 6 integration
│ └── renderers/ # Offline renderers (html, markdown, latex, mermaid, svg, data, office)
├── scripts/
│ ├── build.mjs # esbuild bundler + inline CSS/JS/KaTeX woff2 embedding
│ ├── install.mjs # Installs plugin to ~/.gemini/config/plugins/html-viewer
│ ├── gen-office-demos.mjs # Generates examples/demo.{docx,xlsx,pptx}
│ └── test.mjs # Automated build, MCP handshake & format tests
├── examples/ # Sample files for every supported format
└── .github/workflows/ci.yml # Node 20 CI pipeline
```
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues