@silurus/ooxml 0.70.1 → 0.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,20 @@
1
1
  > **This entire codebase — Rust parsers, TypeScript renderers, tests, and tooling — was implemented by [Claude](https://claude.ai)** (Anthropic's AI assistant) through iterative prompting. No human-written application code exists in this repository.
2
2
 
3
+ <details>
4
+ <summary><b>Why this project exists — a note from the author</b></summary>
5
+
6
+ <br>
7
+
8
+ OOXML's behavior is defined by a written specification (ECMA-376 / ISO-29500), and there is a clear answer to compare against: Word, Excel, and PowerPoint themselves. In principle, anyone with enough patience could have built a faithful viewer — the spec says what to implement, and the Office applications show whether you got it right.
9
+
10
+ In practice, it didn't happen. For more than a decade, no free, open-source library reached a rendering quality good enough for real use. There are a few commercial libraries with decent fidelity (and editing support), but their pricing makes them hard to adopt casually. I think the reason is simply cost: the specification is huge, and reading and implementing it faithfully takes far more effort than volunteers can afford.
11
+
12
+ Generative AI changed that. A viewer is an unusually good fit for AI-driven iterative development ("vibe coding"): there is a spec to read and a correct output to aim for, so the work comes down to interpreting the specification and refining the rendering until it matches. Limiting the scope to viewing also avoids the most serious risk an Office library can carry — corrupting a user's files.
13
+
14
+ So I'm building this library with Claude, spec-first, and keeping it free to use. For some documents it already reproduces the desktop Office applications more faithfully than commercial libraries — and sometimes even the official Microsoft 365 web apps.
15
+
16
+ </details>
17
+
3
18
  <p align="center">
4
19
  <img src="docs/images/icon.png" alt="office-open-xml-viewer" width="160" height="160">
5
20
  </p>
@@ -29,15 +44,23 @@ pnpm add @silurus/ooxml
29
44
 
30
45
  > **Bundler note**: the Rust parsers ship as real `.wasm` asset files next to the
31
46
  > JavaScript, referenced with the standard `new URL('…', import.meta.url)` form
32
- > and fetched (streaming-compiled) at load time. Vite, webpack 5, Rollup and
33
- > Parcel detect that reference and copy the asset automatically — no extra
34
- > WebAssembly plugin is required. esbuild and the Angular CLI (whose application
35
- > builder is esbuild-based) do **not** process that reference
36
- > ([esbuild#795](https://github.com/evanw/esbuild/issues/795)): copy the `.wasm`
37
- > into your served output yourself and point the viewer at it with the `wasmUrl`
38
- > load option see the [Angular example](#framework-examples) for the two-step
39
- > setup. `wasmUrl` also serves the parser WASM from a CDN or any path you
40
- > control:
47
+ > and fetched (streaming-compiled) at load time. Verified to work with zero
48
+ > config: **webpack 5**, **Next.js** (Turbopack, dev and build), **Vite 8**
49
+ > (dev and build), **Vite 7 production builds**, and a plain
50
+ > `<script type="module">` with no bundler at all. Two setups need a hand:
51
+ >
52
+ > - **Vite 7 dev server**: the dependency optimizer rewrites the asset reference
53
+ > into its own cache path and the load fails (fixed in Vite 8). Add
54
+ > `optimizeDeps: { exclude: ['@silurus/ooxml'] }` to your `vite.config`
55
+ > production builds are unaffected.
56
+ > - **esbuild / Angular CLI** (whose application builder is esbuild-based):
57
+ > `new URL` asset references are not processed
58
+ > ([esbuild#795](https://github.com/evanw/esbuild/issues/795)). Copy the
59
+ > `.wasm` into your served output and point the viewer at it with the
60
+ > `wasmUrl` load option — see the [Angular example](#framework-examples) for
61
+ > the two-step setup.
62
+ >
63
+ > `wasmUrl` also serves the parser WASM from a CDN or any path you control:
41
64
  >
42
65
  > ```typescript
43
66
  > new DocxViewer(canvas, { wasmUrl: 'https://cdn.example.com/docx_parser_bg.wasm' });
@@ -233,6 +256,41 @@ here instead of crashing the scroll loop). The parse/render knobs from the
233
256
  headless engines (`mode`, `useGoogleFonts`, `maxZipEntryBytes`, `math`, `dpr`)
234
257
  are accepted too.
235
258
 
259
+ ### Markdown export
260
+
261
+ Every headless engine can project its document to GitHub-flavoured markdown for
262
+ LLM ingestion, full-text search, or diffing — headings, lists, tables, and (for
263
+ docx) footnotes / comments are preserved; layout, fonts, and positioning are
264
+ dropped. The projection is compiled into the parser WASM you already ship, so it
265
+ adds **zero** bundle weight. `toMarkdown()` works in both `mode: 'main'` and
266
+ `mode: 'worker'` (it runs off the archive opened at `load()`):
267
+
268
+ ```typescript
269
+ import { DocxDocument } from '@silurus/ooxml/docx';
270
+
271
+ const doc = await DocxDocument.load('/document.docx');
272
+ const md = await doc.toMarkdown();
273
+ ```
274
+
275
+ `PptxPresentation.toMarkdown()` (title slides → `#` headings, body → nested
276
+ bullets, notes / comments collated) and `XlsxWorkbook.toMarkdown()` (each sheet →
277
+ a `## SheetName` pipe table) are the twins.
278
+
279
+ For a one-off conversion outside a viewer, the standalone
280
+ `@silurus/ooxml-markdown` package exposes the low-level functions and a CLI:
281
+
282
+ ```typescript
283
+ import { docxToMarkdown, initDocxFromBytes } from '@silurus/ooxml-markdown';
284
+
285
+ initDocxFromBytes(wasmBytes); // the docx parser's `_bg.wasm`
286
+ const md = docxToMarkdown(fileBytes); // ArrayBuffer | Uint8Array | Buffer
287
+ ```
288
+
289
+ ```bash
290
+ npx ooxml-md document.docx # → stdout
291
+ npx ooxml-md deck.pptx -o deck.md # → file
292
+ ```
293
+
236
294
  ---
237
295
 
238
296
  <details>
@@ -567,6 +625,9 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
567
625
  | | Page size and margins | ✅ |
568
626
  | | Headers / footers (default / first / even) | ✅ |
569
627
  | | Section breaks (continuous / nextPage / oddPage / evenPage) | ✅ |
628
+ | | Page borders (`w:pgBorders`, §17.6.10 — standard line styles, offsetFrom / display / zOrder; art borders not yet supported) | ✅ |
629
+ | | Line numbering (`w:lnNumType`, §17.6.8) | ✅ |
630
+ | | Section vertical alignment (`w:vAlign`, §17.6.22) | ✅ |
570
631
  | **Text** | Paragraphs | ✅ |
571
632
  | | Bold, italic, underline, strikethrough | ✅ |
572
633
  | | Font family, size, color | ✅ |
@@ -587,22 +648,33 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
587
648
  | | keepNext / keepLines / widowControl | ✅ |
588
649
  | | Right-to-left text — UAX#9 bidi, `w:bidi` / `w:rtl`, complex-script formatting (`w:szCs` / `w:bCs` / `rFonts@cs`, §17.3.2.26), RTL lists and indents | ✅ |
589
650
  | | Japanese kinsoku line breaking (`w:kinsoku`, §17.15.1.58 — 行頭/行末禁則) | ✅ |
651
+ | | Vertical writing (縦書き — UAX#50 vertical glyph forms, 縦中横 tate-chu-yoko runs, 、。 upper-right positioning; §17.3.2 vertical text) | ✅ |
590
652
  | **Elements** | Tables (with borders, fills, merges, banding, alignment) | ✅ |
591
653
  | | Table auto-layout by preferred widths (`w:tblLayout` autofit, §17.4.52; min content width) | ✅ |
654
+ | | Table indent (`w:tblInd`, §17.4.50) | ✅ |
592
655
  | | Right-to-left table column order (`w:bidiVisual`, §17.4.1) | ✅ |
656
+ | | Charts (embedded DrawingML `c:chart` — bar / line / area / pie / doughnut / radar / scatter, via the shared core chart renderer; data labels honour `dLblPos`, §21.2.2.48) | ✅ |
593
657
  | | Math equations (OMML `m:oMath` / `m:oMathPara`, rendered via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
594
658
  | | Images (inline and anchored, with text wrap) | ✅ |
595
659
  | | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
596
660
  | | Text boxes / drawing shapes (`wps:txbx`, `a:prstGeom` — 186 preset geometries via the shared engine; connector arrow heads `headEnd` / `tailEnd` (§20.1.8.3) and `prstDash` dash patterns (§20.1.8.48)). Text-box paragraphs run through the **same line-layout engine as body text**, so kinsoku 行頭/行末禁則 (§17.15.1.58–60), UAX#9 bidi (`w:bidi`, §17.3.1.6), justification (§17.18.44) and tab stops (§17.3.1.37) all apply inside a box | ✅ |
597
- | | WMF metafile images (legacy vector, incl. inside text boxes) — rasterized via a built-in player (window mapping, pens/brushes, poly/rect); true EMF detected but not yet rendered | ✅ |
661
+ | | WMF **and EMF** metafile images (legacy vector, incl. inside text boxes) — rasterized via a built-in player: window→viewport mapping (MS-EMF map modes, world transform), pens/brushes, poly/rect/ellipse, text-out, path clipping, and embedded DIB blits | ✅ |
662
+ | | OLE embedded objects (`w:object` — the baked VML `v:imagedata` preview is drawn; the embedded app is not run) | ✅ |
598
663
  | **Advanced** | Footnotes — reference markers + bottom-of-page bodies with separator rule, numbered (`w:footnoteReference` / `w:footnoteRef`, §17.11) | ✅ |
599
664
  | | Endnotes — reference markers + bodies at document end (`w:endnoteReference`, §17.11) | ✅ |
665
+ | | Page-number formats (`w:pgNumType` restart / format §17.6.12; PAGE `\*` switches — decimal / roman / letter / hex / ordinal-dash / hebrew2 / koreanLegal, §17.18.59) | ✅ |
666
+ | | Field date/time pictures (`TIME` / `DATE` field `\@` format, §17.16.5.72 / .16) | ✅ |
600
667
  | | `w:snapToGrid` opt-out of the document grid (§17.3.1.32) | ✅ |
601
668
  | | Track changes (`w:ins` / `w:del` — author-coloured underline / strikethrough) | ✅ |
602
669
  | | Comments — author / date / text via the document model (`doc.comments`, §17.13.4; not drawn on the page) | ✅ |
670
+ | | Markdown export (`DocxDocument.toMarkdown()` — headings, lists, tables, footnotes / comments; also `@silurus/ooxml-markdown` + the `ooxml-md` CLI) | ✅ |
603
671
  | | Mail merge fields | ❌ Not planned |
604
672
  | **Interaction** | Text selection (transparent overlay, native copy) | ✅ |
673
+ | | In-document find (`findText` / `findNext` / `findPrev` / `clearFind` — full-text search, all hits highlighted, each match tagged with its page) | ✅ |
674
+ | | Runtime zoom (`getScale` / `setScale` / `fitWidth` / `fitPage`) | ✅ |
675
+ | | Clickable hyperlinks (overlay hit-test, `onHyperlinkClick`; internal bookmark / anchor navigation) | ✅ |
605
676
  | | Continuous scroll viewer (`DocxScrollViewer` — virtualized page list, desk background / shadow, Ctrl/⌘+wheel zoom, engine injection) | ✅ |
677
+ | **Loading** | Password-protected files ([MS-OFFCRYPTO] Agile Encryption — `load(bytes, { password })`, decrypted client-side via WebCrypto; legacy Standard / Extensible encryption → typed `unsupported-encryption`) | ✅ |
606
678
 
607
679
  ---
608
680
 
@@ -616,6 +688,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
616
688
  | | Formula results (from cached `<v>`) | ✅ |
617
689
  | | Dates (ECMA-376 date format codes) | ✅ |
618
690
  | | Rich text (per-run formatting) | ✅ |
691
+ | | East-Asian furigana (`<rPh>` §18.4.6 + `<phoneticPr>` §18.4.3 — drawn when a cell opts in via `ph="1"`; row-level `<row ph>` inheritance) | ✅ |
619
692
  | **Formatting** | Bold, italic, underline (`single` / `double` / `singleAccounting` / `doubleAccounting`), strikethrough | ✅ |
620
693
  | | Superscript / subscript (`vertAlign`) | ✅ |
621
694
  | | Font family, size, color | ✅ |
@@ -632,12 +705,14 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
632
705
  | | Frozen panes | ✅ |
633
706
  | | Row / column sizing (custom widths and heights) | ✅ |
634
707
  | | Hidden rows / columns | ✅ |
708
+ | | Row / column outline grouping (`outlineLevel` / `collapsed` §18.3.1.73 / .13, `<outlinePr>` — gutter brackets, +/− collapse, numbered level buttons; view-only) | ✅ |
635
709
  | **Elements** | Images (`<xdr:twoCellAnchor>`) | ✅ |
710
+ | | OLE embedded objects (`<oleObjects>` — the legacy VML `v:imagedata` preview keyed by `oleObject@shapeId` is drawn; an image-typed `objectPr` target is preferred when present, and the embedded app is not run) | ✅ |
636
711
  | | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
637
712
  | | Drawing shapes / text boxes (`xdr:sp`, `xdr:txBody` — 186 preset geometries via the shared engine, with `avLst` adjust handles) | ✅ |
638
713
  | | Math equations in shapes (OMML `m:oMath` / `m:oMathPara` in `xdr:txBody`, incl. `a14:m` / `mc:AlternateContent`; rendered via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
639
714
  | | Charts (bar, line, area, pie, doughnut, radar, scatter / bubble) | ✅ |
640
- | | Chart markers (circle / square / diamond / triangle / x / plus / star / dot / dash, per-point `<c:dPt>` overrides) | ✅ |
715
+ | | Chart markers (circle / square / diamond / triangle / x / plus / star / dot / dash, per-point `<c:dPt>` overrides; markers-only scatter series draw a marker legend key) | ✅ |
641
716
  | | Chart data labels (`<c:dLbl>` per-point with CELLRANGE / VALUE / SERIESNAME / CATEGORYNAME field references, position `l`/`r`/`t`/`b`/`ctr`/`outEnd`) | ✅ |
642
717
  | | Chart error bars (`<c:errBars>` X/Y direction, `cust` / `fixedVal` / `stdErr` / `stdDev` / `percentage`, dashed/styled lines) | ✅ |
643
718
  | | Chart manual layout (`<c:title><c:layout>` and `<c:plotArea><c:layout>`) | ✅ |
@@ -647,6 +722,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
647
722
  | | Pivot tables | ❌ Not planned |
648
723
  | | Cell comments / notes (classic `xl/commentsN.xml` + Office-365 threaded comments — red triangle indicator + author / text via the worksheet model, shown in an Excel-style hover popup) | ✅ |
649
724
  | | Data validation (rules via the worksheet model; `list`-type dropdown arrow on the selected cell whose click opens a panel showing the allowed values — read-only) | ✅ |
725
+ | | Markdown export (`XlsxWorkbook.toMarkdown()` — each sheet as a `## SheetName` pipe table; also `@silurus/ooxml-markdown` + the `ooxml-md` CLI) | ✅ |
650
726
  | **Interaction** | Cell selection (single / range / row / column / all) | ✅ |
651
727
  | | Excel-style row / column header highlight on selection | ✅ |
652
728
  | | Shift+click to extend, Ctrl+C to copy as TSV | ✅ |
@@ -654,8 +730,12 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
654
730
  | | `onSelectionChange` callback, `getCellAt(x, y)` API | ✅ |
655
731
  | | Zoom slider (Excel-style, right of the tab bar, 10–400% with 100% centered; `showZoomSlider` option) | ✅ |
656
732
  | | Ctrl/⌘ + mouse-wheel and trackpad-pinch zoom (in addition to the slider) | ✅ |
733
+ | | Runtime fit / zoom API (`fitWidth` / `fitPage` / `getScale` / `setScale`, in addition to the slider) | ✅ |
734
+ | | In-document find (`findText` / `findNext` / `findPrev` / `clearFind` — matches tagged with sheet + cell) | ✅ |
735
+ | | Clickable hyperlinks (`onHyperlinkClick`; internal defined-name / cell navigation) | ✅ |
657
736
  | | Drag-to-resize columns / rows by dragging header borders (`resizable` option, default on) — **view-only: changes the on-screen view only and never modifies the loaded file** | ✅ |
658
737
  | | Customizable cell-selection color (`selectionColor` option, `setSelectionColor()`) | ✅ |
738
+ | **Loading** | Password-protected files ([MS-OFFCRYPTO] Agile Encryption — `load(bytes, { password })`, decrypted client-side via WebCrypto; legacy Standard / Extensible encryption → typed `unsupported-encryption`) | ✅ |
659
739
 
660
740
  ---
661
741
 
@@ -669,6 +749,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
669
749
  | | Slide background (solid, gradient, image) | ✅ |
670
750
  | | Slide numbers | ✅ |
671
751
  | | Speaker notes (plain text via `getNotes()`) | ✅ |
752
+ | | Markdown export (`PptxPresentation.toMarkdown()` — title slides → headings, body → nested bullets, notes / comments collated; also `@silurus/ooxml-markdown` + the `ooxml-md` CLI) | ✅ |
672
753
  | | Animations / transitions | ❌ Not planned |
673
754
  | **Element types** | Shapes (`sp`) | ✅ |
674
755
  | | Pictures (`pic`) | ✅ |
@@ -681,8 +762,10 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
681
762
  | | Charts (scatter — `scatterStyle` marker / line / smooth variants) | ✅ |
682
763
  | | Charts (bubble — `bubbleSize` per-point area scaling) | ✅ |
683
764
  | | Charts (combo — bar + line with a secondary value axis on the right) | ✅ |
684
- | | SmartArt (renders the PowerPoint-saved drawing layout `dsp:drawing`; no native diagram layout engine) | ✅ |
685
- | | OLE embedded objects (`p:oleObj`preview/icon rendering) | Not planned |
765
+ | | Charts (chartEx funnel / histogram / treemap / sunburst / box &amp; whisker) | ✅ |
766
+ | | Charts (stockhigh / low / close candlesticks) | |
767
+ | | SmartArt (renders the PowerPoint-saved drawing layout `dsp:drawing`, or a staged fallback to a text list when no drawing part is present; no native diagram layout engine) | ✅ |
768
+ | | OLE embedded objects (`p:oleObj` — the baked preview `p:pic` is drawn; the embedded app is not run) | ✅ |
686
769
  | | Video / audio (poster + interactive playback) | ✅ |
687
770
  | | Ink / handwriting (`p:contentPart`, raster fallback) | ✅ |
688
771
  | **Shape geometry** | 186 preset shapes (`prstGeom` — incl. 3D presets cube / can / bevel / frame) | ✅ |
@@ -719,6 +802,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
719
802
  | | Hyperlinks (`hlinkClick` — theme `hlink` colour + auto underline) | ✅ |
720
803
  | | Text shadow (`rPr > effectLst > outerShdw`) | ✅ |
721
804
  | | Text outline (`rPr > a:ln`) | ✅ |
805
+ | | WordArt text warps (`a:prstTxWarp`, §20.1.9.19 — all 40 presets, per-glyph envelope fit incl. Follow Path) | ✅ |
722
806
  | | Text highlight / marker (`a:highlight` — §21.1.2.3.4) | ✅ |
723
807
  | | Math equations (OMML `m:oMath` / `m:oMathPara`, incl. `a14:m` / `mc:AlternateContent`; STIX Two Math via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
724
808
  | **Text — paragraphs** | Horizontal alignment (left / center / right / justify) | ✅ |
@@ -747,7 +831,11 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
747
831
  | | Font scheme (`+mj-lt`, `+mn-lt`) | ✅ |
748
832
  | | lumMod / lumOff / alpha transforms | ✅ |
749
833
  | **Interaction** | Text selection (transparent overlay, native copy) | ✅ |
834
+ | | In-document find (`findText` / `findNext` / `findPrev` / `clearFind` — matches tagged with slide) | ✅ |
835
+ | | Runtime zoom (`getScale` / `setScale` / `fitWidth` / `fitPage`) | ✅ |
836
+ | | Clickable hyperlinks (`onHyperlinkClick`; internal slide-jump navigation) | ✅ |
750
837
  | | Continuous scroll viewer (`PptxScrollViewer` — virtualized slide list, desk background / shadow, Ctrl/⌘+wheel zoom, engine injection) | ✅ |
838
+ | **Loading** | Password-protected files ([MS-OFFCRYPTO] Agile Encryption — `load(bytes, { password })`, decrypted client-side via WebCrypto; legacy Standard / Extensible encryption → typed `unsupported-encryption`) | ✅ |
751
839
 
752
840
  ---
753
841
 
@@ -806,7 +894,29 @@ cd packages/pptx/parser && wasm-pack build --target web && cp pkg/pptx_parser_bg
806
894
  Supported uniformly by `DocxViewer`, `PptxViewer`, and `XlsxViewer`. Zero / negative values fall back to the default.
807
895
  - **No network by default.** The library does not send telemetry or analytics, and does not contact third-party services unless you ask it to. In particular, theme webfonts, Office font metric substitutes (Carlito/Caladea), and the script fallback fonts are **not** loaded from Google Fonts unless you pass `useGoogleFonts: true` to the relevant `Viewer` / `load(...)` options — supported uniformly by `DocxViewer`, `PptxViewer`, and `XlsxViewer`. When enabled, fonts for non-Latin scripts are supplied on demand from Noto families so text does not fall back to tofu: Arabic (Noto Naskh/Sans Arabic), CJK (Noto Sans/Serif KR · SC · TC · JP, picked per document language so shared Han glyphs take the right shapes), Cyrillic (Noto Sans/Serif), Hebrew (Noto Sans/Serif Hebrew, RTL), Thai (Noto Sans Thai) and Devanagari (Noto Sans Devanagari). No font binaries ship in the bundle. Enabling this option causes the end-user's browser to send an HTTP request (IP and User-Agent) to `fonts.googleapis.com`, which may have GDPR implications for your application — consider self-hosting the required fonts via `@font-face` instead.
808
896
  - **XML parsing.** Uses `roxmltree`, which does not resolve external entities (XXE-safe by default).
897
+ - **Encrypted OOXML ([MS-OFFCRYPTO] Agile Encryption).** Password-protected `.docx` / `.xlsx` / `.pptx` files are OLE2/CFB containers, not ZIPs. Pass `password` to `load(...)` and the file is decrypted **client-side** via WebCrypto — no bytes and no password leave the browser:
898
+ ```ts
899
+ const doc = await DocxDocument.load(bytes, { password: 'secret' });
900
+ ```
901
+ Key derivation (SHA-512 spin, commonly 100,000 iterations) and AES-CBC segment decryption run on the main thread and add roughly a second before parsing. Failures are typed [`OoxmlError`](packages/core/src/errors/ooxml-error.ts)s: no `password` on an encrypted file → `encrypted`, wrong `password` → `invalid-password`, a non-Agile scheme (legacy **Standard** / **Extensible** encryption, or an encrypted legacy binary `.doc`/`.xls`/`.ppt`) → `unsupported-encryption`. **Note:** decryption recovers the plaintext but does **not** verify the file's HMAC data-integrity tag ([MS-OFFCRYPTO] §2.3.4.14), so tampering with the ciphertext is not detected — treat decrypted output from untrusted sources with the same care as any other input.
809
902
 
810
903
  ## License
811
904
 
812
905
  MIT
906
+
907
+ ## Third-Party Notices
908
+
909
+ The library's own code is MIT-licensed. It also bundles a small set of
910
+ permissively-licensed third-party components — see
911
+ [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) (included in the npm
912
+ tarball) for the full list and license texts. Highlights:
913
+
914
+ - **[MathJax](https://www.mathjax.org/) + STIX Two Math**
915
+ (Apache License 2.0) — the equation-rendering engine behind the
916
+ opt-in `@silurus/ooxml/math` entry described in
917
+ [Rendering equations](#rendering-equations). It ships in the tarball as
918
+ a standalone ~3 MB asset but is never loaded by a consuming app unless
919
+ that app imports `@silurus/ooxml/math` and the viewer is handed a
920
+ document that actually contains an equation.
921
+ - **Rust crate dependencies** of the WASM parsers (docx/pptx/xlsx) — all
922
+ MIT / Apache-2.0 (or compatible permissive licenses), no copyleft.
@@ -0,0 +1,283 @@
1
+ # Third-Party Notices
2
+
3
+ `@silurus/ooxml` is MIT-licensed (see [LICENSE](./LICENSE)). It bundles the
4
+ third-party components listed below, none of which are copyleft. This file
5
+ is included in the npm tarball so it travels with every install.
6
+
7
+ ## JavaScript / bundled asset
8
+
9
+ ### MathJax + STIX Two Math (`mathjax-stix2.js`)
10
+
11
+ The optional equation-rendering engine (`@silurus/ooxml/math`, opt-in —
12
+ see the [README's "Rendering equations" section](./README.md#rendering-equations))
13
+ pre-bundles two Apache-2.0 packages into a single ~3 MB asset
14
+ (`packages/core/assets/mathjax-stix2.js`, built by
15
+ [`packages/core/build/build-mathjax.mjs`](./packages/core/build/build-mathjax.mjs)).
16
+ It ships in the npm tarball but is only fetched by a consuming app at
17
+ runtime if that app imports `@silurus/ooxml/math` **and** the loaded
18
+ document actually contains an equation.
19
+
20
+ - **[MathJax](https://www.mathjax.org/)** (`@mathjax/src`, v4.1.2) —
21
+ Copyright © MathJax Consortium. Licensed under the
22
+ [Apache License, Version 2.0](#apache-license-20-full-text).
23
+ <https://github.com/mathjax/MathJax-src>
24
+ - **STIX Two Math font, as packaged for MathJax v4**
25
+ (`@mathjax/mathjax-stix2-font`, v4.1.2) — Copyright © MathJax Consortium.
26
+ The npm package declares `"license": "Apache-2.0"` in its `package.json`
27
+ (verified by reading `node_modules/@mathjax/mathjax-stix2-font/package.json`
28
+ directly; the package does not bundle its own `LICENSE` file, so this is
29
+ the authoritative declaration). Licensed under the
30
+ [Apache License, Version 2.0](#apache-license-20-full-text).
31
+ <https://github.com/mathjax/MathJax-fonts>
32
+
33
+ Note: the STIX Two Math font is also separately distributed upstream
34
+ (<https://github.com/stipub/stixfonts>) under the SIL Open Font License
35
+ 1.1. The build in this repository consumes the Apache-2.0-licensed
36
+ `@mathjax/mathjax-stix2-font` npm package specifically, not the upstream
37
+ OFL font files directly, so Apache-2.0 is the governing license for the
38
+ bytes actually shipped here.
39
+
40
+ Neither package includes a Apache-2.0 §4(d) `NOTICE` file (checked in
41
+ the installed `node_modules` tree), so there is no additional NOTICE
42
+ content to reproduce beyond the attribution above.
43
+
44
+ ### Build-time only (not shipped)
45
+
46
+ The library also declares `esbuild` (MIT) as a build-time dependency
47
+ (bundles `mathjax-stix2.js` above) and TypeScript (Apache-2.0) as a
48
+ dev/type-check dependency. Neither's code is included in the published
49
+ package — noted here for completeness only.
50
+
51
+ ## Rust / WebAssembly
52
+
53
+ The three parser crates (`docx-parser`, `pptx-parser`, `xlsx-parser`) and
54
+ their shared `ooxml-common` crate compile to the `*_parser_bg.wasm` binaries
55
+ shipped in `dist/`. Their `wasm32-unknown-unknown` dependency graph is
56
+ identical across all three crates (verified with `cargo license
57
+ --filter-platform wasm32-unknown-unknown`) and consists entirely of
58
+ permissively-licensed crates — no copyleft (GPL/LGPL/AGPL) dependencies:
59
+
60
+ | License | Crates |
61
+ |---|---|
62
+ | MIT OR Apache-2.0 | bumpalo, cfg-if, console_error_panic_hook, crc32fast, displaydoc, equivalent, flate2, hashbrown, indexmap, itoa, log, once_cell, proc-macro2, quote, roxmltree, rustversion, serde, serde_core, serde_derive, serde_json, syn, thiserror, thiserror-impl, wasm-bindgen, wasm-bindgen-macro, wasm-bindgen-macro-support, wasm-bindgen-shared |
63
+ | (Apache-2.0 OR MIT) AND Unicode-3.0 | unicode-ident |
64
+ | 0BSD OR Apache-2.0 OR MIT | adler2 |
65
+ | Apache-2.0 | zopfli |
66
+ | Apache-2.0 OR MIT OR Zlib | miniz_oxide |
67
+ | MIT | simd-adler32, zip, zmij |
68
+ | MIT OR Unlicense | memchr |
69
+
70
+ Full license texts for each crate are available from
71
+ [crates.io](https://crates.io/) or the crate's own repository; SPDX
72
+ identifiers above match each crate's `Cargo.toml` `license` field. This
73
+ list was generated with:
74
+
75
+ ```bash
76
+ cargo install cargo-license
77
+ cargo license --manifest-path packages/pptx/parser/Cargo.toml \
78
+ --avoid-dev-deps --filter-platform wasm32-unknown-unknown
79
+ # docx-parser / xlsx-parser produce an identical dependency set
80
+ ```
81
+
82
+ ### MCP server (`ooxml-mcp-server`, separate distribution)
83
+
84
+ `packages/mcp-server` is not part of the `@silurus/ooxml` npm package — it
85
+ is a standalone binary distributed independently (see the repository's MCP
86
+ server documentation). Its dependency graph is a superset of the table
87
+ above (adds `tokio`, `rmcp`, `anyhow`, `schemars`, `tracing`, and their
88
+ transitive deps for the async runtime and MCP protocol implementation) and
89
+ remains entirely MIT / Apache-2.0, with no copyleft licenses:
90
+
91
+ ```bash
92
+ cargo license --manifest-path packages/mcp-server/Cargo.toml --avoid-dev-deps
93
+ ```
94
+
95
+ ## License texts
96
+
97
+ - **MIT** — see [LICENSE](./LICENSE) (this repository's own license; the
98
+ MIT-licensed dependencies above use the same standard text with their own
99
+ copyright holder).
100
+ - **Apache License, Version 2.0** — full text at
101
+ <https://www.apache.org/licenses/LICENSE-2.0>, reproduced below for
102
+ convenience.
103
+
104
+ ### Apache License 2.0 (full text)
105
+
106
+ ```
107
+ Apache License
108
+ Version 2.0, January 2004
109
+ http://www.apache.org/licenses/
110
+
111
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
112
+
113
+ 1. Definitions.
114
+
115
+ "License" shall mean the terms and conditions for use, reproduction,
116
+ and distribution as defined by Sections 1 through 9 of this document.
117
+
118
+ "Licensor" shall mean the copyright owner or entity authorized by
119
+ the copyright owner that is granting the License.
120
+
121
+ "Legal Entity" shall mean the union of the acting entity and all
122
+ other entities that control, are controlled by, or are under common
123
+ control with that entity. For the purposes of this definition,
124
+ "control" means (i) the power, direct or indirect, to cause the
125
+ direction or management of such entity, whether by contract or
126
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
127
+ outstanding shares, or (iii) beneficial ownership of such entity.
128
+
129
+ "You" (or "Your") shall mean an individual or Legal Entity
130
+ exercising permissions granted by this License.
131
+
132
+ "Source" form shall mean the preferred form for making modifications,
133
+ including but not limited to software source code, documentation
134
+ source, and configuration files.
135
+
136
+ "Object" form shall mean any form resulting from mechanical
137
+ transformation or translation of a Source form, including but
138
+ not limited to compiled object code, generated documentation,
139
+ and conversions to other media types.
140
+
141
+ "Work" shall mean the work of authorship, whether in Source or
142
+ Object form, made available under the License, as indicated by a
143
+ copyright notice that is included in or attached to the work
144
+ (an example is provided in the Appendix below).
145
+
146
+ "Derivative Works" shall mean any work, whether in Source or Object
147
+ form, that is based on (or derived from) the Work and for which the
148
+ editorial revisions, annotations, elaborations, or other modifications
149
+ represent, as a whole, an original work of authorship. For the purposes
150
+ of this License, Derivative Works shall not include works that remain
151
+ separable from, or merely link (or bind by name) to the interfaces of,
152
+ the Work and Derivative Works thereof.
153
+
154
+ "Contribution" shall mean any work of authorship, including
155
+ the original version of the Work and any modifications or additions
156
+ to that Work or Derivative Works thereof, that is intentionally
157
+ submitted to Licensor for inclusion in the Work by the copyright owner
158
+ or by an individual or Legal Entity authorized to submit on behalf of
159
+ the copyright owner. For the purposes of this definition, "submitted"
160
+ means any form of electronic, verbal, or written communication sent
161
+ to the Licensor or its representatives, including but not limited to
162
+ communication on electronic mailing lists, source code control systems,
163
+ and issue tracking systems that are managed by, or on behalf of, the
164
+ Licensor for the purpose of discussing and improving the Work, but
165
+ excluding communication that is conspicuously marked or otherwise
166
+ designated in writing by the copyright owner as "Not a Contribution."
167
+
168
+ "Contributor" shall mean Licensor and any individual or Legal Entity
169
+ on behalf of whom a Contribution has been received by Licensor and
170
+ subsequently incorporated within the Work.
171
+
172
+ 2. Grant of Copyright License. Subject to the terms and conditions of
173
+ this License, each Contributor hereby grants to You a perpetual,
174
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
175
+ copyright license to reproduce, prepare Derivative Works of,
176
+ publicly display, publicly perform, sublicense, and distribute the
177
+ Work and such Derivative Works in Source or Object form.
178
+
179
+ 3. Grant of Patent License. Subject to the terms and conditions of
180
+ this License, each Contributor hereby grants to You a perpetual,
181
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
182
+ (except as stated in this section) patent license to make, have made,
183
+ use, offer to sell, sell, import, and otherwise transfer the Work,
184
+ where such license applies only to those patent claims licensable
185
+ by such Contributor that are necessarily infringed by their
186
+ Contribution(s) alone or by combination of their Contribution(s)
187
+ with the Work to which such Contribution(s) was submitted. If You
188
+ institute patent litigation against any entity (including a
189
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
190
+ or a Contribution incorporated within the Work constitutes direct
191
+ or contributory patent infringement, then any patent licenses
192
+ granted to You under this License for that Work shall terminate
193
+ as of the date such litigation is filed.
194
+
195
+ 4. Redistribution. You may reproduce and distribute copies of the
196
+ Work or Derivative Works thereof in any medium, with or without
197
+ modifications, and in Source or Object form, provided that You
198
+ meet the following conditions:
199
+
200
+ (a) You must give any other recipients of the Work or
201
+ Derivative Works a copy of this License; and
202
+
203
+ (b) You must cause any modified files to carry prominent notices
204
+ stating that You changed the files; and
205
+
206
+ (c) You must retain, in the Source form of any Derivative Works
207
+ that You distribute, all copyright, patent, trademark, and
208
+ attribution notices from the Source form of the Work,
209
+ excluding those notices that do not pertain to any part of
210
+ the Derivative Works; and
211
+
212
+ (d) If the Work includes a "NOTICE" text file as part of its
213
+ distribution, then any Derivative Works that You distribute must
214
+ include a readable copy of the attribution notices contained
215
+ within such NOTICE file, excluding those notices that do not
216
+ pertain to any part of the Derivative Works, in at least one
217
+ of the following places: within a NOTICE text file distributed
218
+ as part of the Derivative Works; within the Source form or
219
+ documentation, if provided along with the Derivative Works; or,
220
+ within a display generated by the Derivative Works, if and
221
+ wherever such third-party notices normally appear. The contents
222
+ of the NOTICE file are for informational purposes only and
223
+ do not modify the License. You may add Your own attribution
224
+ notices within Derivative Works that You distribute, alongside
225
+ or as an addendum to the NOTICE text from the Work, provided
226
+ that such additional attribution notices cannot be construed
227
+ as modifying the License.
228
+
229
+ You may add Your own copyright statement to Your modifications and
230
+ may provide additional or different license terms and conditions
231
+ for use, reproduction, or distribution of Your modifications, or
232
+ for any such Derivative Works as a whole, provided Your use,
233
+ reproduction, and distribution of the Work otherwise complies with
234
+ the conditions stated in this License.
235
+
236
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
237
+ any Contribution intentionally submitted for inclusion in the Work
238
+ by You to the Licensor shall be under the terms and conditions of
239
+ this License, without any additional terms or conditions.
240
+ Notwithstanding the above, nothing herein shall supersede or modify
241
+ the terms of any separate license agreement you may have executed
242
+ with Licensor regarding such Contributions.
243
+
244
+ 6. Trademarks. This License does not grant permission to use the trade
245
+ names, trademarks, service marks, or product names of the Licensor,
246
+ except as required for reasonable and customary use in describing the
247
+ origin of the Work and reproducing the content of the NOTICE file.
248
+
249
+ 7. Disclaimer of Warranty. Unless required by applicable law or
250
+ agreed to in writing, Licensor provides the Work (and each
251
+ Contributor provides its Contributions) on an "AS IS" BASIS,
252
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
253
+ implied, including, without limitation, any warranties or conditions
254
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
255
+ PARTICULAR PURPOSE. You are solely responsible for determining the
256
+ appropriateness of using or redistributing the Work and assume any
257
+ risks associated with Your exercise of permissions under this License.
258
+
259
+ 8. Limitation of Liability. In no event and under no legal theory,
260
+ whether in tort (including negligence), contract, or otherwise,
261
+ unless required by applicable law (such as deliberate and grossly
262
+ negligent acts) or agreed to in writing, shall any Contributor be
263
+ liable to You for damages, including any direct, indirect, special,
264
+ incidental, or consequential damages of any character arising as a
265
+ result of this License or out of the use or inability to use the
266
+ Work (including but not limited to damages for loss of goodwill,
267
+ work stoppage, computer failure or malfunction, or any and all
268
+ other commercial damages or losses), even if such Contributor
269
+ has been advised of the possibility of such damages.
270
+
271
+ 9. Accepting Warranty or Additional Liability. While redistributing
272
+ the Work or Derivative Works thereof, You may choose to offer,
273
+ and charge a fee for, acceptance of support, warranty, indemnity,
274
+ or other liability obligations and/or rights consistent with this
275
+ License. However, in accepting such obligations, You may act only
276
+ on Your own behalf and on Your sole responsibility, not on behalf
277
+ of any other Contributor, and only if You agree to indemnify,
278
+ defend, and hold each Contributor harmless for any liability
279
+ incurred by, or claims asserted against, such Contributor by reason
280
+ of your accepting any such warranty or additional liability.
281
+
282
+ END OF TERMS AND CONDITIONS
283
+ ```