@bendyline/squisq-formats 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +105 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # @bendyline/squisq-formats
2
+
3
+ Document format converters for Squisq. Import and export between Squisq's Markdown-based document model and common file formats — DOCX, PDF, and HTML. All converters run entirely in the browser with no server or native binaries required.
4
+
5
+ Part of the [Squisq](https://github.com/bendyline/squisq) monorepo.
6
+
7
+ [![npm](https://img.shields.io/npm/v/@bendyline/squisq-formats)](https://www.npmjs.com/package/@bendyline/squisq-formats)
8
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bendyline/squisq/blob/main/LICENSE)
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @bendyline/squisq-formats @bendyline/squisq
14
+ ```
15
+
16
+ ## Supported Formats
17
+
18
+ | Format | Import | Export | Subpath |
19
+ | --------------------- | ------- | ------- | -------------------------------- |
20
+ | **DOCX** (Word) | ✅ | ✅ | `@bendyline/squisq-formats/docx` |
21
+ | **PDF** | ✅ | ✅ | `@bendyline/squisq-formats/pdf` |
22
+ | **HTML** | — | ✅ | `@bendyline/squisq-formats/html` |
23
+ | **PPTX** (PowerPoint) | planned | planned | `@bendyline/squisq-formats/pptx` |
24
+ | **XLSX** (Excel) | planned | planned | `@bendyline/squisq-formats/xlsx` |
25
+
26
+ ## Quick Examples
27
+
28
+ ### DOCX
29
+
30
+ ```ts
31
+ import { markdownDocToDocx, docxToMarkdownDoc } from '@bendyline/squisq-formats/docx';
32
+
33
+ // Export: MarkdownDocument → DOCX (Uint8Array)
34
+ const docxBytes = await markdownDocToDocx(markdownDoc);
35
+
36
+ // Import: DOCX (ArrayBuffer) → MarkdownDocument
37
+ const markdownDoc = await docxToMarkdownDoc(docxBuffer);
38
+ ```
39
+
40
+ ### PDF
41
+
42
+ ```ts
43
+ import {
44
+ markdownDocToPdf,
45
+ pdfToMarkdownDoc,
46
+ configurePdfWorker,
47
+ } from '@bendyline/squisq-formats/pdf';
48
+
49
+ // Configure the PDF.js worker (required for import)
50
+ configurePdfWorker('/pdf.worker.min.mjs');
51
+
52
+ // Export: MarkdownDocument → PDF (Uint8Array)
53
+ const pdfBytes = await markdownDocToPdf(markdownDoc);
54
+
55
+ // Import: PDF (ArrayBuffer) → MarkdownDocument
56
+ const markdownDoc = await pdfToMarkdownDoc(pdfBuffer);
57
+ ```
58
+
59
+ ### HTML
60
+
61
+ ```ts
62
+ import { docToHtml, docToHtmlZip } from '@bendyline/squisq-formats/html';
63
+
64
+ // Export: Doc → standalone HTML string
65
+ const html = docToHtml(doc);
66
+
67
+ // Export: Doc → ZIP with HTML + images
68
+ const zipBytes = await docToHtmlZip(doc);
69
+ ```
70
+
71
+ ### Doc-level Convenience Functions
72
+
73
+ Each format also exports `Doc`-level wrappers that handle the Markdown↔Doc conversion internally:
74
+
75
+ ```ts
76
+ import { docToDocx, docxToDoc } from '@bendyline/squisq-formats/docx';
77
+ import { docToPdf, pdfToDoc } from '@bendyline/squisq-formats/pdf';
78
+ ```
79
+
80
+ ## Subpath Exports
81
+
82
+ | Subpath | Contents |
83
+ | --------------------------------- | -------------------------------------------------------------- |
84
+ | `@bendyline/squisq-formats/docx` | DOCX import/export |
85
+ | `@bendyline/squisq-formats/pdf` | PDF import/export + worker config |
86
+ | `@bendyline/squisq-formats/html` | HTML export |
87
+ | `@bendyline/squisq-formats/ooxml` | Shared OOXML infrastructure (ZIP reader/writer, XML utilities) |
88
+ | `@bendyline/squisq-formats/pptx` | PPTX stubs (not yet implemented) |
89
+ | `@bendyline/squisq-formats/xlsx` | XLSX stubs (not yet implemented) |
90
+
91
+ ## Architecture
92
+
93
+ All converters use Squisq's `MarkdownDocument` AST as the pivot format. Importing a file parses it into a `MarkdownDocument`; exporting serializes from one. The OOXML subpath provides shared infrastructure for reading and writing Office Open XML packages (used by DOCX, and eventually PPTX/XLSX).
94
+
95
+ ## Related Packages
96
+
97
+ | Package | Description |
98
+ | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
99
+ | [@bendyline/squisq](https://www.npmjs.com/package/@bendyline/squisq) | Headless core — schemas, templates, spatial, markdown, storage |
100
+ | [@bendyline/squisq-react](https://www.npmjs.com/package/@bendyline/squisq-react) | React components for rendering docs |
101
+ | [@bendyline/squisq-editor-react](https://www.npmjs.com/package/@bendyline/squisq-editor-react) | React editor with raw/WYSIWYG/preview modes |
102
+
103
+ ## License
104
+
105
+ [MIT](https://github.com/bendyline/squisq/blob/main/LICENSE)
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-formats",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Document format converters — DOCX, PDF, OOXML import/export",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/nicknisi/squisq.git",
9
+ "url": "https://github.com/bendyline/squisq.git",
10
10
  "directory": "packages/formats"
11
11
  },
12
- "homepage": "https://github.com/nicknisi/squisq",
12
+ "homepage": "https://github.com/bendyline/squisq",
13
13
  "keywords": [
14
14
  "docx",
15
15
  "pdf",
@@ -73,7 +73,7 @@
73
73
  "prepublishOnly": "npm run build"
74
74
  },
75
75
  "dependencies": {
76
- "@bendyline/squisq": "0.1.1",
76
+ "@bendyline/squisq": "0.1.2",
77
77
  "jszip": "^3.10.1",
78
78
  "pdf-lib": "^1.17.1",
79
79
  "pdfjs-dist": "^4.9.155"