@silurus/ooxml 0.70.2 → 0.72.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,4 +1,19 @@
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.
1
+ > **This entire codebase — Rust parsers, TypeScript renderers, tests, and tooling — is implemented by AI coding agents, primarily [Claude](https://claude.ai) and [Codex](https://openai.com/codex/)**, through iterative prompting. No human-written application code exists in this repository.
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 AI coding agents, 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>
2
17
 
3
18
  <p align="center">
4
19
  <img src="docs/images/icon.png" alt="office-open-xml-viewer" width="160" height="160">
@@ -214,6 +229,20 @@ a transparent, selectable text layer per page/slide for native copy. In
214
229
  worker boundary) and the viewer logs one warning — use the default `mode: 'main'`
215
230
  for selectable text.
216
231
 
232
+ **Hyperlinks.** For DOCX/PPTX the link hit regions live on the text-selection
233
+ overlay, so hyperlink interaction requires `enableTextSelection: true`; when that
234
+ overlay is enabled, links are interactive by default. XLSX hit-tests cells
235
+ directly, so links are interactive out of the box. An external link opens in a
236
+ new tab (scheme-sanitized to `http` / `https` / `mailto` / `tel`, `noopener`),
237
+ and an internal target navigates within the document (docx bookmark, pptx slide
238
+ jump, xlsx sheet). Pass `onHyperlinkClick(target)` to take over the click
239
+ yourself.
240
+ Pass `enableHyperlinks: false` to disable hyperlink interactivity entirely — no
241
+ hit-testing, no pointer cursor over links, no default navigation, and
242
+ `onHyperlinkClick` is never called; links still render as authored but are inert.
243
+ This applies to every viewer that supports hyperlinks (`DocxViewer`,
244
+ `DocxScrollViewer`, `PptxViewer`, `PptxScrollViewer`, `XlsxViewer`).
245
+
217
246
  **Master–detail / shared engine.** Inject an already-loaded headless engine so a
218
247
  paged viewer and a scroll viewer (or several panes) share **one** parse. When you
219
248
  inject, `load()` is unsupported (the engine is already loaded), the engine's own
@@ -241,6 +270,41 @@ here instead of crashing the scroll loop). The parse/render knobs from the
241
270
  headless engines (`mode`, `useGoogleFonts`, `maxZipEntryBytes`, `math`, `dpr`)
242
271
  are accepted too.
243
272
 
273
+ ### Markdown export
274
+
275
+ Every headless engine can project its document to GitHub-flavoured markdown for
276
+ LLM ingestion, full-text search, or diffing — headings, lists, tables, and (for
277
+ docx) footnotes / comments are preserved; layout, fonts, and positioning are
278
+ dropped. The projection is compiled into the parser WASM you already ship, so it
279
+ adds **zero** bundle weight. `toMarkdown()` works in both `mode: 'main'` and
280
+ `mode: 'worker'` (it runs off the archive opened at `load()`):
281
+
282
+ ```typescript
283
+ import { DocxDocument } from '@silurus/ooxml/docx';
284
+
285
+ const doc = await DocxDocument.load('/document.docx');
286
+ const md = await doc.toMarkdown();
287
+ ```
288
+
289
+ `PptxPresentation.toMarkdown()` (title slides → `#` headings, body → nested
290
+ bullets, notes / comments collated) and `XlsxWorkbook.toMarkdown()` (each sheet →
291
+ a `## SheetName` pipe table) are the twins.
292
+
293
+ For a one-off conversion outside a viewer, the standalone
294
+ `@silurus/ooxml-markdown` package exposes the low-level functions and a CLI:
295
+
296
+ ```typescript
297
+ import { docxToMarkdown, initDocxFromBytes } from '@silurus/ooxml-markdown';
298
+
299
+ initDocxFromBytes(wasmBytes); // the docx parser's `_bg.wasm`
300
+ const md = docxToMarkdown(fileBytes); // ArrayBuffer | Uint8Array | Buffer
301
+ ```
302
+
303
+ ```bash
304
+ npx ooxml-md document.docx # → stdout
305
+ npx ooxml-md deck.pptx -o deck.md # → file
306
+ ```
307
+
244
308
  ---
245
309
 
246
310
  <details>
@@ -366,7 +430,7 @@ const current = ref(0);
366
430
  const total = ref(0);
367
431
 
368
432
  onMounted(async () => {
369
- viewer = new PptxViewer(canvas.value!, {
433
+ viewer = new PptxViewer(canvas.value as HTMLCanvasElement, {
370
434
  onSlideChange: (i, t) => { current.value = i; total.value = t; },
371
435
  });
372
436
  await viewer.load(props.src);
@@ -575,6 +639,9 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
575
639
  | | Page size and margins | ✅ |
576
640
  | | Headers / footers (default / first / even) | ✅ |
577
641
  | | Section breaks (continuous / nextPage / oddPage / evenPage) | ✅ |
642
+ | | Page borders (`w:pgBorders`, §17.6.10 — standard line styles, offsetFrom / display / zOrder; art borders not yet supported) | ✅ |
643
+ | | Line numbering (`w:lnNumType`, §17.6.8) | ✅ |
644
+ | | Section vertical alignment (`w:vAlign`, §17.6.22) | ✅ |
578
645
  | **Text** | Paragraphs | ✅ |
579
646
  | | Bold, italic, underline, strikethrough | ✅ |
580
647
  | | Font family, size, color | ✅ |
@@ -595,22 +662,33 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
595
662
  | | keepNext / keepLines / widowControl | ✅ |
596
663
  | | 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 | ✅ |
597
664
  | | Japanese kinsoku line breaking (`w:kinsoku`, §17.15.1.58 — 行頭/行末禁則) | ✅ |
665
+ | | Vertical writing (縦書き — UAX#50 vertical glyph forms, 縦中横 tate-chu-yoko runs, 、。 upper-right positioning; §17.3.2 vertical text) | ✅ |
598
666
  | **Elements** | Tables (with borders, fills, merges, banding, alignment) | ✅ |
599
667
  | | Table auto-layout by preferred widths (`w:tblLayout` autofit, §17.4.52; min content width) | ✅ |
668
+ | | Table indent (`w:tblInd`, §17.4.50) | ✅ |
600
669
  | | Right-to-left table column order (`w:bidiVisual`, §17.4.1) | ✅ |
670
+ | | 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) | ✅ |
601
671
  | | Math equations (OMML `m:oMath` / `m:oMathPara`, rendered via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
602
672
  | | Images (inline and anchored, with text wrap) | ✅ |
603
673
  | | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
604
674
  | | 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 | ✅ |
605
- | | 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 | ✅ |
675
+ | | 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 | ✅ |
676
+ | | OLE embedded objects (`w:object` — the baked VML `v:imagedata` preview is drawn; the embedded app is not run) | ✅ |
606
677
  | **Advanced** | Footnotes — reference markers + bottom-of-page bodies with separator rule, numbered (`w:footnoteReference` / `w:footnoteRef`, §17.11) | ✅ |
607
678
  | | Endnotes — reference markers + bodies at document end (`w:endnoteReference`, §17.11) | ✅ |
679
+ | | Page-number formats (`w:pgNumType` restart / format §17.6.12; PAGE `\*` switches — decimal / roman / letter / hex / ordinal-dash / hebrew2 / koreanLegal, §17.18.59) | ✅ |
680
+ | | Field date/time pictures (`TIME` / `DATE` field `\@` format, §17.16.5.72 / .16) | ✅ |
608
681
  | | `w:snapToGrid` opt-out of the document grid (§17.3.1.32) | ✅ |
609
682
  | | Track changes (`w:ins` / `w:del` — author-coloured underline / strikethrough) | ✅ |
610
683
  | | Comments — author / date / text via the document model (`doc.comments`, §17.13.4; not drawn on the page) | ✅ |
684
+ | | Markdown export (`DocxDocument.toMarkdown()` — headings, lists, tables, footnotes / comments; also `@silurus/ooxml-markdown` + the `ooxml-md` CLI) | ✅ |
611
685
  | | Mail merge fields | ❌ Not planned |
612
686
  | **Interaction** | Text selection (transparent overlay, native copy) | ✅ |
687
+ | | In-document find (`findText` / `findNext` / `findPrev` / `clearFind` — full-text search, all hits highlighted, each match tagged with its page) | ✅ |
688
+ | | Runtime zoom (`getScale` / `setScale` / `fitWidth` / `fitPage`) | ✅ |
689
+ | | Clickable hyperlinks (overlay hit-test, `onHyperlinkClick`; internal bookmark / anchor navigation) | ✅ |
613
690
  | | Continuous scroll viewer (`DocxScrollViewer` — virtualized page list, desk background / shadow, Ctrl/⌘+wheel zoom, engine injection) | ✅ |
691
+ | **Loading** | Password-protected files ([MS-OFFCRYPTO] Agile Encryption — `load(bytes, { password })`, decrypted client-side via WebCrypto; legacy Standard / Extensible encryption → typed `unsupported-encryption`) | ✅ |
614
692
 
615
693
  ---
616
694
 
@@ -624,6 +702,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
624
702
  | | Formula results (from cached `<v>`) | ✅ |
625
703
  | | Dates (ECMA-376 date format codes) | ✅ |
626
704
  | | Rich text (per-run formatting) | ✅ |
705
+ | | 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) | ✅ |
627
706
  | **Formatting** | Bold, italic, underline (`single` / `double` / `singleAccounting` / `doubleAccounting`), strikethrough | ✅ |
628
707
  | | Superscript / subscript (`vertAlign`) | ✅ |
629
708
  | | Font family, size, color | ✅ |
@@ -640,12 +719,14 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
640
719
  | | Frozen panes | ✅ |
641
720
  | | Row / column sizing (custom widths and heights) | ✅ |
642
721
  | | Hidden rows / columns | ✅ |
722
+ | | Row / column outline grouping (`outlineLevel` / `collapsed` §18.3.1.73 / .13, `<outlinePr>` — gutter brackets, +/− collapse, numbered level buttons; view-only) | ✅ |
643
723
  | **Elements** | Images (`<xdr:twoCellAnchor>`) | ✅ |
724
+ | | 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) | ✅ |
644
725
  | | SVG images (`asvg:svgBlip` MS-2016 extension — vector drawn from the embedded `.svg`, raster fallback) | ✅ |
645
726
  | | Drawing shapes / text boxes (`xdr:sp`, `xdr:txBody` — 186 preset geometries via the shared engine, with `avLst` adjust handles) | ✅ |
646
727
  | | 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`) | ✅ |
647
728
  | | Charts (bar, line, area, pie, doughnut, radar, scatter / bubble) | ✅ |
648
- | | Chart markers (circle / square / diamond / triangle / x / plus / star / dot / dash, per-point `<c:dPt>` overrides) | ✅ |
729
+ | | 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) | ✅ |
649
730
  | | Chart data labels (`<c:dLbl>` per-point with CELLRANGE / VALUE / SERIESNAME / CATEGORYNAME field references, position `l`/`r`/`t`/`b`/`ctr`/`outEnd`) | ✅ |
650
731
  | | Chart error bars (`<c:errBars>` X/Y direction, `cust` / `fixedVal` / `stdErr` / `stdDev` / `percentage`, dashed/styled lines) | ✅ |
651
732
  | | Chart manual layout (`<c:title><c:layout>` and `<c:plotArea><c:layout>`) | ✅ |
@@ -655,6 +736,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
655
736
  | | Pivot tables | ❌ Not planned |
656
737
  | | 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) | ✅ |
657
738
  | | 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) | ✅ |
739
+ | | Markdown export (`XlsxWorkbook.toMarkdown()` — each sheet as a `## SheetName` pipe table; also `@silurus/ooxml-markdown` + the `ooxml-md` CLI) | ✅ |
658
740
  | **Interaction** | Cell selection (single / range / row / column / all) | ✅ |
659
741
  | | Excel-style row / column header highlight on selection | ✅ |
660
742
  | | Shift+click to extend, Ctrl+C to copy as TSV | ✅ |
@@ -662,8 +744,12 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
662
744
  | | `onSelectionChange` callback, `getCellAt(x, y)` API | ✅ |
663
745
  | | Zoom slider (Excel-style, right of the tab bar, 10–400% with 100% centered; `showZoomSlider` option) | ✅ |
664
746
  | | Ctrl/⌘ + mouse-wheel and trackpad-pinch zoom (in addition to the slider) | ✅ |
747
+ | | Runtime fit / zoom API (`fitWidth` / `fitPage` / `getScale` / `setScale`, in addition to the slider) | ✅ |
748
+ | | In-document find (`findText` / `findNext` / `findPrev` / `clearFind` — matches tagged with sheet + cell) | ✅ |
749
+ | | Clickable hyperlinks (`onHyperlinkClick`; internal defined-name / cell navigation) | ✅ |
665
750
  | | 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** | ✅ |
666
751
  | | Customizable cell-selection color (`selectionColor` option, `setSelectionColor()`) | ✅ |
752
+ | **Loading** | Password-protected files ([MS-OFFCRYPTO] Agile Encryption — `load(bytes, { password })`, decrypted client-side via WebCrypto; legacy Standard / Extensible encryption → typed `unsupported-encryption`) | ✅ |
667
753
 
668
754
  ---
669
755
 
@@ -677,6 +763,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
677
763
  | | Slide background (solid, gradient, image) | ✅ |
678
764
  | | Slide numbers | ✅ |
679
765
  | | Speaker notes (plain text via `getNotes()`) | ✅ |
766
+ | | Markdown export (`PptxPresentation.toMarkdown()` — title slides → headings, body → nested bullets, notes / comments collated; also `@silurus/ooxml-markdown` + the `ooxml-md` CLI) | ✅ |
680
767
  | | Animations / transitions | ❌ Not planned |
681
768
  | **Element types** | Shapes (`sp`) | ✅ |
682
769
  | | Pictures (`pic`) | ✅ |
@@ -689,8 +776,10 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
689
776
  | | Charts (scatter — `scatterStyle` marker / line / smooth variants) | ✅ |
690
777
  | | Charts (bubble — `bubbleSize` per-point area scaling) | ✅ |
691
778
  | | Charts (combo — bar + line with a secondary value axis on the right) | ✅ |
692
- | | SmartArt (renders the PowerPoint-saved drawing layout `dsp:drawing`; no native diagram layout engine) | ✅ |
693
- | | OLE embedded objects (`p:oleObj`preview/icon rendering) | Not planned |
779
+ | | Charts (chartEx funnel / histogram / treemap / sunburst / box &amp; whisker) | ✅ |
780
+ | | Charts (stockhigh / low / close candlesticks) | |
781
+ | | 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) | ✅ |
782
+ | | OLE embedded objects (`p:oleObj` — the baked preview `p:pic` is drawn; the embedded app is not run) | ✅ |
694
783
  | | Video / audio (poster + interactive playback) | ✅ |
695
784
  | | Ink / handwriting (`p:contentPart`, raster fallback) | ✅ |
696
785
  | **Shape geometry** | 186 preset shapes (`prstGeom` — incl. 3D presets cube / can / bevel / frame) | ✅ |
@@ -727,6 +816,7 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
727
816
  | | Hyperlinks (`hlinkClick` — theme `hlink` colour + auto underline) | ✅ |
728
817
  | | Text shadow (`rPr > effectLst > outerShdw`) | ✅ |
729
818
  | | Text outline (`rPr > a:ln`) | ✅ |
819
+ | | WordArt text warps (`a:prstTxWarp`, §20.1.9.19 — all 40 presets, per-glyph envelope fit incl. Follow Path) | ✅ |
730
820
  | | Text highlight / marker (`a:highlight` — §21.1.2.3.4) | ✅ |
731
821
  | | Math equations (OMML `m:oMath` / `m:oMathPara`, incl. `a14:m` / `mc:AlternateContent`; STIX Two Math via MathJax — opt-in `@silurus/ooxml/math`) | ✅ |
732
822
  | **Text — paragraphs** | Horizontal alignment (left / center / right / justify) | ✅ |
@@ -755,7 +845,11 @@ export const PptxViewerComponent = component$<{ src: string }>(({ src }) => {
755
845
  | | Font scheme (`+mj-lt`, `+mn-lt`) | ✅ |
756
846
  | | lumMod / lumOff / alpha transforms | ✅ |
757
847
  | **Interaction** | Text selection (transparent overlay, native copy) | ✅ |
848
+ | | In-document find (`findText` / `findNext` / `findPrev` / `clearFind` — matches tagged with slide) | ✅ |
849
+ | | Runtime zoom (`getScale` / `setScale` / `fitWidth` / `fitPage`) | ✅ |
850
+ | | Clickable hyperlinks (`onHyperlinkClick`; internal slide-jump navigation) | ✅ |
758
851
  | | Continuous scroll viewer (`PptxScrollViewer` — virtualized slide list, desk background / shadow, Ctrl/⌘+wheel zoom, engine injection) | ✅ |
852
+ | **Loading** | Password-protected files ([MS-OFFCRYPTO] Agile Encryption — `load(bytes, { password })`, decrypted client-side via WebCrypto; legacy Standard / Extensible encryption → typed `unsupported-encryption`) | ✅ |
759
853
 
760
854
  ---
761
855
 
@@ -814,7 +908,29 @@ cd packages/pptx/parser && wasm-pack build --target web && cp pkg/pptx_parser_bg
814
908
  Supported uniformly by `DocxViewer`, `PptxViewer`, and `XlsxViewer`. Zero / negative values fall back to the default.
815
909
  - **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.
816
910
  - **XML parsing.** Uses `roxmltree`, which does not resolve external entities (XXE-safe by default).
911
+ - **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:
912
+ ```ts
913
+ const doc = await DocxDocument.load(bytes, { password: 'secret' });
914
+ ```
915
+ 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.
817
916
 
818
917
  ## License
819
918
 
820
919
  MIT
920
+
921
+ ## Third-Party Notices
922
+
923
+ The library's own code is MIT-licensed. It also bundles a small set of
924
+ permissively-licensed third-party components — see
925
+ [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) (included in the npm
926
+ tarball) for the full list and license texts. Highlights:
927
+
928
+ - **[MathJax](https://www.mathjax.org/) + STIX Two Math**
929
+ (Apache License 2.0) — the equation-rendering engine behind the
930
+ opt-in `@silurus/ooxml/math` entry described in
931
+ [Rendering equations](#rendering-equations). It ships in the tarball as
932
+ a standalone ~3 MB asset but is never loaded by a consuming app unless
933
+ that app imports `@silurus/ooxml/math` and the viewer is handed a
934
+ document that actually contains an equation.
935
+ - **Rust crate dependencies** of the WASM parsers (docx/pptx/xlsx) — all
936
+ MIT / Apache-2.0 (or compatible permissive licenses), no copyleft.
@@ -0,0 +1,356 @@
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
+ ## Unicode Character Database data
96
+
97
+ The line-breaking, vertical-orientation and Arabic-shaping logic is driven
98
+ by tables generated from the Unicode Character Database (UCD), © Unicode,
99
+ Inc., licensed under the [Unicode License v3](#unicode-license-v3-full-text)
100
+ (SPDX: `Unicode-3.0`), which expressly permits copying, modification and
101
+ redistribution of the data files with this notice.
102
+
103
+ Checked into this repository (generator inputs, each retaining its original
104
+ Unicode copyright header; not part of the npm tarball):
105
+
106
+ - `packages/core/scripts/VerticalOrientation.txt` (UAX #50
107
+ Vertical_Orientation, UCD 17.0.0)
108
+ - `packages/docx/scripts/ArabicShaping.txt` (Joining_Type / Joining_Group,
109
+ UCD 17.0.0)
110
+ - `packages/docx/scripts/DerivedJoiningType.txt` (UCD 17.0.0)
111
+
112
+ Shipped in `dist/` as UCD-derived data compiled from the above and from
113
+ `LineBreak.txt` / `DerivedGeneralCategory.txt` / `EastAsianWidth.txt`
114
+ (fetched at generation time, not checked in): the `*.generated.ts` tables
115
+ under `packages/core/src/text/` and `packages/docx/src/` (line-break
116
+ classes, East Asian width, vertical orientation, bidi character data,
117
+ Arabic joining classes).
118
+
119
+ The `unicode-ident` Rust crate listed above also carries `Unicode-3.0` in
120
+ its SPDX expression for the same reason (embedded UCD-derived tables).
121
+
122
+ ## License texts
123
+
124
+ - **MIT** — see [LICENSE](./LICENSE) (this repository's own license; the
125
+ MIT-licensed dependencies above use the same standard text with their own
126
+ copyright holder).
127
+ - **Unicode License v3** — canonical text at
128
+ <https://www.unicode.org/license.txt>, reproduced below.
129
+ - **Apache License, Version 2.0** — full text at
130
+ <https://www.apache.org/licenses/LICENSE-2.0>, reproduced below for
131
+ convenience.
132
+
133
+ ### Unicode License v3 (full text)
134
+
135
+ ```
136
+ UNICODE LICENSE V3
137
+
138
+ COPYRIGHT AND PERMISSION NOTICE
139
+
140
+ Copyright © 1991-2026 Unicode, Inc.
141
+
142
+ NOTICE TO USER: Carefully read the following legal agreement. BY
143
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
144
+ SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
145
+ TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
146
+ DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
147
+
148
+ Permission is hereby granted, free of charge, to any person obtaining a
149
+ copy of data files and any associated documentation (the "Data Files") or
150
+ software and any associated documentation (the "Software") to deal in the
151
+ Data Files or Software without restriction, including without limitation
152
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
153
+ copies of the Data Files or Software, and to permit persons to whom the
154
+ Data Files or Software are furnished to do so, provided that either (a)
155
+ this copyright and permission notice appear with all copies of the Data
156
+ Files or Software, or (b) this copyright and permission notice appear in
157
+ associated Documentation.
158
+
159
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
160
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
161
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
162
+ THIRD PARTY RIGHTS.
163
+
164
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
165
+ BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
166
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
167
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
168
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
169
+ FILES OR SOFTWARE.
170
+
171
+ Except as contained in this notice, the name of a copyright holder shall
172
+ not be used in advertising or otherwise to promote the sale, use or other
173
+ dealings in these Data Files or Software without prior written
174
+ authorization of the copyright holder.
175
+ ```
176
+
177
+ ### Apache License 2.0 (full text)
178
+
179
+ ```
180
+ Apache License
181
+ Version 2.0, January 2004
182
+ http://www.apache.org/licenses/
183
+
184
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
185
+
186
+ 1. Definitions.
187
+
188
+ "License" shall mean the terms and conditions for use, reproduction,
189
+ and distribution as defined by Sections 1 through 9 of this document.
190
+
191
+ "Licensor" shall mean the copyright owner or entity authorized by
192
+ the copyright owner that is granting the License.
193
+
194
+ "Legal Entity" shall mean the union of the acting entity and all
195
+ other entities that control, are controlled by, or are under common
196
+ control with that entity. For the purposes of this definition,
197
+ "control" means (i) the power, direct or indirect, to cause the
198
+ direction or management of such entity, whether by contract or
199
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
200
+ outstanding shares, or (iii) beneficial ownership of such entity.
201
+
202
+ "You" (or "Your") shall mean an individual or Legal Entity
203
+ exercising permissions granted by this License.
204
+
205
+ "Source" form shall mean the preferred form for making modifications,
206
+ including but not limited to software source code, documentation
207
+ source, and configuration files.
208
+
209
+ "Object" form shall mean any form resulting from mechanical
210
+ transformation or translation of a Source form, including but
211
+ not limited to compiled object code, generated documentation,
212
+ and conversions to other media types.
213
+
214
+ "Work" shall mean the work of authorship, whether in Source or
215
+ Object form, made available under the License, as indicated by a
216
+ copyright notice that is included in or attached to the work
217
+ (an example is provided in the Appendix below).
218
+
219
+ "Derivative Works" shall mean any work, whether in Source or Object
220
+ form, that is based on (or derived from) the Work and for which the
221
+ editorial revisions, annotations, elaborations, or other modifications
222
+ represent, as a whole, an original work of authorship. For the purposes
223
+ of this License, Derivative Works shall not include works that remain
224
+ separable from, or merely link (or bind by name) to the interfaces of,
225
+ the Work and Derivative Works thereof.
226
+
227
+ "Contribution" shall mean any work of authorship, including
228
+ the original version of the Work and any modifications or additions
229
+ to that Work or Derivative Works thereof, that is intentionally
230
+ submitted to Licensor for inclusion in the Work by the copyright owner
231
+ or by an individual or Legal Entity authorized to submit on behalf of
232
+ the copyright owner. For the purposes of this definition, "submitted"
233
+ means any form of electronic, verbal, or written communication sent
234
+ to the Licensor or its representatives, including but not limited to
235
+ communication on electronic mailing lists, source code control systems,
236
+ and issue tracking systems that are managed by, or on behalf of, the
237
+ Licensor for the purpose of discussing and improving the Work, but
238
+ excluding communication that is conspicuously marked or otherwise
239
+ designated in writing by the copyright owner as "Not a Contribution."
240
+
241
+ "Contributor" shall mean Licensor and any individual or Legal Entity
242
+ on behalf of whom a Contribution has been received by Licensor and
243
+ subsequently incorporated within the Work.
244
+
245
+ 2. Grant of Copyright License. Subject to the terms and conditions of
246
+ this License, each Contributor hereby grants to You a perpetual,
247
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
248
+ copyright license to reproduce, prepare Derivative Works of,
249
+ publicly display, publicly perform, sublicense, and distribute the
250
+ Work and such Derivative Works in Source or Object form.
251
+
252
+ 3. Grant of Patent License. Subject to the terms and conditions of
253
+ this License, each Contributor hereby grants to You a perpetual,
254
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
255
+ (except as stated in this section) patent license to make, have made,
256
+ use, offer to sell, sell, import, and otherwise transfer the Work,
257
+ where such license applies only to those patent claims licensable
258
+ by such Contributor that are necessarily infringed by their
259
+ Contribution(s) alone or by combination of their Contribution(s)
260
+ with the Work to which such Contribution(s) was submitted. If You
261
+ institute patent litigation against any entity (including a
262
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
263
+ or a Contribution incorporated within the Work constitutes direct
264
+ or contributory patent infringement, then any patent licenses
265
+ granted to You under this License for that Work shall terminate
266
+ as of the date such litigation is filed.
267
+
268
+ 4. Redistribution. You may reproduce and distribute copies of the
269
+ Work or Derivative Works thereof in any medium, with or without
270
+ modifications, and in Source or Object form, provided that You
271
+ meet the following conditions:
272
+
273
+ (a) You must give any other recipients of the Work or
274
+ Derivative Works a copy of this License; and
275
+
276
+ (b) You must cause any modified files to carry prominent notices
277
+ stating that You changed the files; and
278
+
279
+ (c) You must retain, in the Source form of any Derivative Works
280
+ that You distribute, all copyright, patent, trademark, and
281
+ attribution notices from the Source form of the Work,
282
+ excluding those notices that do not pertain to any part of
283
+ the Derivative Works; and
284
+
285
+ (d) If the Work includes a "NOTICE" text file as part of its
286
+ distribution, then any Derivative Works that You distribute must
287
+ include a readable copy of the attribution notices contained
288
+ within such NOTICE file, excluding those notices that do not
289
+ pertain to any part of the Derivative Works, in at least one
290
+ of the following places: within a NOTICE text file distributed
291
+ as part of the Derivative Works; within the Source form or
292
+ documentation, if provided along with the Derivative Works; or,
293
+ within a display generated by the Derivative Works, if and
294
+ wherever such third-party notices normally appear. The contents
295
+ of the NOTICE file are for informational purposes only and
296
+ do not modify the License. You may add Your own attribution
297
+ notices within Derivative Works that You distribute, alongside
298
+ or as an addendum to the NOTICE text from the Work, provided
299
+ that such additional attribution notices cannot be construed
300
+ as modifying the License.
301
+
302
+ You may add Your own copyright statement to Your modifications and
303
+ may provide additional or different license terms and conditions
304
+ for use, reproduction, or distribution of Your modifications, or
305
+ for any such Derivative Works as a whole, provided Your use,
306
+ reproduction, and distribution of the Work otherwise complies with
307
+ the conditions stated in this License.
308
+
309
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
310
+ any Contribution intentionally submitted for inclusion in the Work
311
+ by You to the Licensor shall be under the terms and conditions of
312
+ this License, without any additional terms or conditions.
313
+ Notwithstanding the above, nothing herein shall supersede or modify
314
+ the terms of any separate license agreement you may have executed
315
+ with Licensor regarding such Contributions.
316
+
317
+ 6. Trademarks. This License does not grant permission to use the trade
318
+ names, trademarks, service marks, or product names of the Licensor,
319
+ except as required for reasonable and customary use in describing the
320
+ origin of the Work and reproducing the content of the NOTICE file.
321
+
322
+ 7. Disclaimer of Warranty. Unless required by applicable law or
323
+ agreed to in writing, Licensor provides the Work (and each
324
+ Contributor provides its Contributions) on an "AS IS" BASIS,
325
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
326
+ implied, including, without limitation, any warranties or conditions
327
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
328
+ PARTICULAR PURPOSE. You are solely responsible for determining the
329
+ appropriateness of using or redistributing the Work and assume any
330
+ risks associated with Your exercise of permissions under this License.
331
+
332
+ 8. Limitation of Liability. In no event and under no legal theory,
333
+ whether in tort (including negligence), contract, or otherwise,
334
+ unless required by applicable law (such as deliberate and grossly
335
+ negligent acts) or agreed to in writing, shall any Contributor be
336
+ liable to You for damages, including any direct, indirect, special,
337
+ incidental, or consequential damages of any character arising as a
338
+ result of this License or out of the use or inability to use the
339
+ Work (including but not limited to damages for loss of goodwill,
340
+ work stoppage, computer failure or malfunction, or any and all
341
+ other commercial damages or losses), even if such Contributor
342
+ has been advised of the possibility of such damages.
343
+
344
+ 9. Accepting Warranty or Additional Liability. While redistributing
345
+ the Work or Derivative Works thereof, You may choose to offer,
346
+ and charge a fee for, acceptance of support, warranty, indemnity,
347
+ or other liability obligations and/or rights consistent with this
348
+ License. However, in accepting such obligations, You may act only
349
+ on Your own behalf and on Your sole responsibility, not on behalf
350
+ of any other Contributor, and only if You agree to indemnify,
351
+ defend, and hold each Contributor harmless for any liability
352
+ incurred by, or claims asserted against, such Contributor by reason
353
+ of your accepting any such warranty or additional liability.
354
+
355
+ END OF TERMS AND CONDITIONS
356
+ ```