Skip to content

ViewThemAllPreview any file. One library.

A framework-agnostic TypeScript library that normalizes every common file format into a unified model, then renders it with a single engine.

ViewThemAll preview

How it works

File (any format) │ ▼ AdapterRegistry.resolve(file) → Adapter │ ▼ adapter.parse(file, { signal }) → Result<DocumentModel> │ ├── ok: true → render(model, container) → DOM └── ok: false → renderError(error, container) → error UI

Adapters know nothing about the DOM. The renderer knows nothing about file formats. The engine coordinates. Errors are values — no exceptions cross module boundaries.

One-minute quick-start

ts
import { registerAdapter, engine } from 'viewthemall'
import { docxAdapter }     from 'viewthemall/adapters/docx'
import { xlsxAdapter }     from 'viewthemall/adapters/xlsx'
import { pdfAdapter }      from 'viewthemall/adapters/pdf'
import { csvAdapter }      from 'viewthemall/adapters/csv'
import { textCodeAdapter } from 'viewthemall/adapters/text-code'
import { mdAdapter }       from 'viewthemall/adapters/md'
import { imageAdapter }    from 'viewthemall/adapters/image'

// Register the formats you want to support
registerAdapter(docxAdapter)
registerAdapter(xlsxAdapter)
registerAdapter(pdfAdapter)
registerAdapter(csvAdapter)
registerAdapter(textCodeAdapter)
registerAdapter(mdAdapter)   // after text-code — overrides .md/.mdx
registerAdapter(imageAdapter)

// One call to preview any file
const container = document.getElementById('preview')!
await engine.preview(file, container)

Why not just use X?

LibraryProblem
Mammoth.jsHTML output only — no structured model, no table data, fragile output
SheetJSRaw data, no type detection, no header awareness, no render layer
pdf.jsCanvas-only, completely different API from every other format
Prism.jsCode only — different API, no integration with document formats

ViewThemAll normalises ALL formats into one DocumentModel and renders with one engine.