Skip to content

feat(docx): native OOXML viewer — fresh start (v2.0.0)#1

Merged
ROOCKY-dev merged 1 commit into
mainfrom
fresh-start
Mar 19, 2026
Merged

feat(docx): native OOXML viewer — fresh start (v2.0.0)#1
ROOCKY-dev merged 1 commit into
mainfrom
fresh-start

Conversation

@ROOCKY-dev
Copy link
Copy Markdown
Owner

Overview

Major refactor introducing native DOCX/OOXML support with a complete architectural overhaul.

Key Changes

New DOCX Engine

  • Added native OOXML parser and renderer (src/docx/)
  • Implemented document model, relationships, and styles management
  • Added support for numbering/lists and XML utilities
  • Full DOCX rendering without external dependencies

Removed Features

  • Removed PDF viewer (PdfView.ts, PdfSearchController.ts)
  • Removed PowerPoint support (PptxView.ts)
  • Removed Spreadsheet viewer (SpreadsheetView.ts)
  • Removed deprecated utilities (formulaEval, pdfExport, pdfSnap, docxUtils, annotations)

Refactoring

  • Simplified main.ts entry point
  • Streamlined DocxView.ts with new native renderer
  • Reduced styles.css significantly
  • Updated build config (esbuild.config.mjs) and dependencies (package.json)
  • Added unit conversion utilities

Dependencies

  • Significant package-lock.json reduction
  • Updated manifest and versions for v2.0.0

Migration

This is a breaking change focusing exclusively on native DOCX document viewing.

Strip all non-docx file types (PDF, PPTX, XLSX) and rebuild the .docx
viewer from scratch using direct OOXML parsing (JSZip + DOMParser)
instead of HTML conversion.

- Parse word/document.xml, styles.xml, numbering.xml, relationships
- Render via Obsidian's createEl() — no innerHTML, no React
- Resolve full style inheritance chains (basedOn) for paragraph & run
  properties including numbering definitions from styles
- Generate Word numbering text prefixes from lvlText format strings
  (e.g. "Part 1:", "Step 3:", "a.") with proper counter tracking
- Handle structured document tags (w:sdt) for title and content blocks
- Force color inheritance via inline styles to prevent Obsidian theme
  from overriding document text colors on headings and bold elements
- Fix boolean property merging (Partial overrides vs style defaults)
- Support tables, images, hyperlinks, highlights, breaks, tabs
- Strip 7 heavy deps (mammoth, pdfjs, xlsx, etc.) — bundle down to ~117KB
- CSS uses only Obsidian variables, via- class prefix throughout

Assisted by ClaudeCode
Copilot AI review requested due to automatic review settings March 19, 2026 06:35
@ROOCKY-dev ROOCKY-dev merged commit a9ca850 into main Mar 19, 2026
6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Major refactor to make ViewItAll a DOCX-only plugin by introducing a new native OOXML parsing + rendering pipeline and removing the previous PDF/Spreadsheet/PPTX viewers and related utilities.

Changes:

  • Added a new src/docx/ engine (model, relationships, numbering, styles parsing, renderer, and parser orchestration).
  • Simplified plugin entry points/settings/types to focus on DOCX only.
  • Removed PDF/Spreadsheet/PPTX viewers and supporting utilities; trimmed CSS and build config accordingly.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
versions.json Adds v2 version mapping for update compatibility.
styles.css Removes legacy viewer styles; adds DOCX-focused styling.
src/views/pdf/pdfTypes.ts Removes PDF shared types (PDF viewer removed).
src/views/pdf/PdfSearchController.ts Removes PDF search controller (PDF viewer removed).
src/views/SpreadsheetView.ts Removes spreadsheet viewer implementation.
src/views/PptxView.ts Removes PPTX viewer implementation.
src/views/PdfView.ts Removes PDF viewer implementation.
src/views/DocxView.ts Replaces mammoth/html editing pipeline with native OOXML parse+render view and toolbar/zoom.
src/utils/xml.ts Adds OOXML namespace + DOM helper utilities.
src/utils/units.ts Adds unit conversion helpers for OOXML measurements.
src/utils/pdfSnap.ts Removes PDF snapping utility (PDF tooling removed).
src/utils/pdfExport.ts Removes PDF export utility (PDF tooling removed).
src/utils/formulaEval.ts Removes spreadsheet formula evaluator (spreadsheet viewer removed).
src/utils/fileUtils.ts Removes file path helpers used by removed features.
src/utils/docxUtils.ts Removes mammoth/html-to-docx conversion utilities (old DOCX pipeline removed).
src/utils/annotations.ts Removes PDF annotations utilities (PDF tooling removed).
src/types.ts Removes PDF/PPTX/spreadsheet view types and annotation types; keeps DOCX view type.
src/settings.ts Removes non-DOCX settings; keeps DOCX enable/toolbar/zoom settings.
src/main.ts Registers only DOCX view/extension; removes PDF/PPTX/spreadsheet registration logic.
src/docx/styles.ts New OOXML styles parser + inheritance resolver.
src/docx/renderer.ts New DOM renderer for the DOCX document model.
src/docx/relationships.ts New relationships parser for hyperlinks/images/styles/numbering.
src/docx/parser.ts New DOCX parser orchestrating ZIP extraction + model building.
src/docx/numbering.ts New numbering parser for list definitions.
src/docx/model.ts New TypeScript document model definitions for OOXML content.
package.json Bumps to v2, trims dependencies to jszip + obsidian, updates description/scripts.
manifest.json Updates manifest metadata for v2.
esbuild.config.mjs Removes PDF-worker and punycode plugins; simplifies externals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/docx/styles.ts
if (outlineLvlEl) {
const val = safeParseInt(getVal(outlineLvlEl));
if (val !== undefined && val >= 0 && val <= 5) {
props.headingLevel = val + 1;
Comment thread src/docx/renderer.ts
Comment on lines +538 to +540
// Skip cells that are vertically merged continuations
if (cell.properties.verticalMerge === "continue") {
// Increment the rowspan of the cell that started this merge
Comment thread src/docx/parser.ts
Comment on lines +22 to +36
import {
NS_W,
NS_R,
NS_WP,
NS_A,
NS_PIC,
getElement,
getElements,
getDirectChild,
getDirectChildren,
getVal,
getWAttr,
getAttr,
parseXml,
} from "../utils/xml";
Comment thread src/docx/parser.ts
}

if (children.length === 0) return null;

Comment thread manifest.json
"id": "viewitall",
"name": "View It All",
"version": "1.5.0",
"version": "2.0.1",
Comment thread manifest.json
"version": "2.0.1",
"minAppVersion": "0.15.0",
"description": "View and edit MS (.docx - .xlsx - .csv - .pptx ) and more file types directly inside the app — no external apps needed.",
"description": "View and edit Word documents (.docx) natively in Obsidian.",
Comment thread package.json
"version": "1.5.0",
"description": "Open and edit PDF, Word, Excel, CSV, and PowerPoint files directly inside Obsidian.",
"version": "2.0.0",
"description": "View and edit Word documents (.docx) natively in Obsidian.",
Comment thread src/views/DocxView.ts
});
setTooltip(zoomLabel, "Reset zoom");
zoomLabel.addEventListener("click", () => {
this.currentZoom = 1.0;
Comment thread versions.json
"1.4.2": "0.15.0",
"1.5.0": "0.15.0"
"1.5.0": "0.15.0",
"2.0.0": "0.15.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants