@mdgate/pptx 0.6.7 → 0.6.9

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 +162 -8
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  # @mdgate/pptx
2
2
 
3
- Convert PowerPoint presentations to Markdown. Outputs GitHub-Flavored Markdown. Works in Node, Edge, and
4
- browsers. No native addons.
3
+ **Convert PowerPoint to Markdown in TypeScript.**
5
4
 
6
- Handles: `.pptx`, `.pptm`, `.ppsx`, `.ppsm`, `.potx`, `.potm`
5
+ [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) reads `.pptx`, `.pptm`, `.ppsx`, `.ppsm`, `.potx`, and `.potm` files directly in JavaScript and converts slides into GitHub-Flavored Markdown, without Python, native addons, WASM, or PowerPoint.
7
6
 
8
- ## Usage
7
+ Works in **Node.js, Cloudflare Workers, Edge runtimes, and browsers**.
8
+
9
+ ```bash
10
+ npm install @mdgate/pptx
11
+ ```
9
12
 
10
13
  ```ts
11
14
  import { toMarkdown } from '@mdgate/pptx';
@@ -13,14 +16,165 @@ import { toMarkdown } from '@mdgate/pptx';
13
16
  const markdown = await toMarkdown(bytes);
14
17
  ```
15
18
 
16
- Compose with other converters:
19
+ `bytes` is a `Uint8Array`, so the deck can come from a file upload, object storage, an HTTP request, a browser file picker, or anywhere else your application gets bytes.
20
+
21
+ ---
22
+
23
+ ## Why [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx)
24
+
25
+ Slide decks are a common way people store the actual argument: titles, bullets, tables, speaker notes.
26
+
27
+ [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) is a PresentationML reader written for the same runtime as your application:
28
+
29
+ * **Pure TypeScript**
30
+ * **PPTX → Markdown locally**
31
+ * **No Python runtime**
32
+ * **No native addons**
33
+ * **No WASM runtime**
34
+ * **Zero third-party runtime dependencies**
35
+ * **Works with raw `Uint8Array` input**
36
+ * **Detects OOXML presentations from their contents, not only the filename**
37
+
38
+ Use it when an agent needs the contents of a deck, not a screenshot pipeline.
39
+
40
+ ---
41
+
42
+ ## What it extracts
43
+
44
+ [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) walks slides in package order and applies the text cascade: slide, then layout, then master, then presentation defaults.
45
+
46
+ The converter handles PowerPoint-specific concerns including:
47
+
48
+ * slide titles and body text
49
+ * lists
50
+ * tables
51
+ * speaker notes, rendered as a block quote after each slide
52
+ * charts and diagrams as readable blocks when present
53
+ * images that can be handed to a reader composed with [`@mdgate/core`](https://github.com/mdgate/converters/tree/main/packages/core)
54
+
55
+ The output is Markdown that can be searched, indexed, chunked, cached, or passed directly to an AI agent.
56
+
57
+ Legacy binary `.ppt` files are a different format. Use [`@mdgate/ppt`](https://github.com/mdgate/converters/tree/main/packages/ppt) for those.
58
+
59
+ ---
60
+
61
+ ## Node.js
62
+
63
+ ```ts
64
+ import { readFile } from 'node:fs/promises';
65
+ import { toMarkdown } from '@mdgate/pptx';
66
+
67
+ const bytes = new Uint8Array(await readFile('deck.pptx'));
68
+ const markdown = await toMarkdown(bytes);
69
+
70
+ console.log(markdown);
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Browser
76
+
77
+ ```ts
78
+ import { toMarkdown } from '@mdgate/pptx';
79
+
80
+ const file = input.files![0];
81
+ const bytes = new Uint8Array(await file.arrayBuffer());
82
+
83
+ const markdown = await toMarkdown(bytes);
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Cloudflare Workers and Edge runtimes
89
+
90
+ ```ts
91
+ import { toMarkdown } from '@mdgate/pptx';
92
+
93
+ export default {
94
+ async fetch(request: Request) {
95
+ const bytes = new Uint8Array(await request.arrayBuffer());
96
+ const markdown = await toMarkdown(bytes);
97
+
98
+ return new Response(markdown, {
99
+ headers: {
100
+ 'content-type': 'text/markdown; charset=utf-8',
101
+ },
102
+ });
103
+ },
104
+ };
105
+ ```
106
+
107
+ ```text
108
+ upload PPTX
109
+
110
+ Cloudflare Worker
111
+
112
+ @mdgate/pptx
113
+
114
+ Markdown
115
+
116
+ agent / search / index / storage
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Format detection
122
+
123
+ You do not need to trust the file extension.
124
+
125
+ [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) recognizes PowerPoint OOXML packages from ZIP package metadata.
126
+
127
+ ```ts
128
+ const markdown = await toMarkdown(bytes);
129
+ ```
130
+
131
+ A path can still be supplied as a format hint when [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) is used through [`@mdgate/converters`](https://github.com/mdgate/converters/tree/main/packages/converters) or a reader composed with [`@mdgate/core`](https://github.com/mdgate/converters/tree/main/packages/core), but the path is never used to read a file from disk.
132
+
133
+ ---
134
+
135
+ ## Compose it with other file readers
136
+
137
+ [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) implements the converter interface from [`@mdgate/core`](https://github.com/mdgate/converters/tree/main/packages/core).
17
138
 
18
139
  ```ts
19
140
  import { create } from '@mdgate/core';
20
141
  import { pptx } from '@mdgate/pptx';
142
+ import { pdf } from '@mdgate/pdf';
143
+ import { docx } from '@mdgate/docx';
144
+
145
+ const read = create([
146
+ pptx(),
147
+ pdf(),
148
+ docx(),
149
+ ]);
150
+ ```
151
+
152
+ The application still uses one reading interface while each format remains independently installable.
153
+
154
+ ---
155
+
156
+ ## Need more than PowerPoint?
157
+
158
+ If your application needs to read many different file types, use the complete converter set:
21
159
 
22
- const convert = create([pptx()]);
160
+ ```bash
161
+ npm install @mdgate/converters
23
162
  ```
24
163
 
25
- Part of [mdgate converters](https://github.com/mdgate/converters); install
26
- `@mdgate/converters` for every format at once.
164
+ ```ts
165
+ import { toMarkdown } from '@mdgate/converters';
166
+
167
+ const markdown = await toMarkdown(bytes, {
168
+ path: filename,
169
+ });
170
+ ```
171
+
172
+ [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) is one of the single-format packages in the open-source [`mdgate/converters`](https://github.com/mdgate/converters) project.
173
+
174
+ For AI agents, the same converter architecture can be used to extend `read_file` from text files to real-world document formats.
175
+
176
+ ---
177
+
178
+ ## License
179
+
180
+ MIT
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@mdgate/pptx",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "mdgate PowerPoint converter (pptx/pptm/ppsx/ppsm)",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "homepage": "https://demo.mdgate.dev",
7
+ "homepage": "https://convert.mdgate.dev",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/mdgate/converters.git",
@@ -28,11 +28,11 @@
28
28
  "prepublishOnly": "bun run build"
29
29
  },
30
30
  "dependencies": {
31
- "@mdgate/containers": "0.6.7",
32
- "@mdgate/core": "0.6.7",
33
- "@mdgate/document": "0.6.7",
34
- "@mdgate/office-common": "0.6.7",
35
- "@mdgate/utils": "0.6.7"
31
+ "@mdgate/containers": "0.6.9",
32
+ "@mdgate/core": "0.6.9",
33
+ "@mdgate/document": "0.6.9",
34
+ "@mdgate/office-common": "0.6.9",
35
+ "@mdgate/utils": "0.6.9"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"