@mdgate/keynote 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.
- package/README.md +144 -8
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,26 +1,162 @@
|
|
|
1
1
|
# @mdgate/keynote
|
|
2
2
|
|
|
3
|
-
Convert Apple Keynote presentations to Markdown
|
|
4
|
-
browsers. No native addons.
|
|
3
|
+
**Convert Apple Keynote presentations to Markdown in TypeScript.**
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
[`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote) reads `.key` files directly in JavaScript and converts slides into GitHub-Flavored Markdown, without Python, native addons, WASM, or Keynote.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
Works in **Node.js, Cloudflare Workers, Edge runtimes, and browsers**.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @mdgate/keynote
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { toMarkdown } from '@mdgate/keynote';
|
|
15
|
+
|
|
16
|
+
const markdown = await toMarkdown(bytes);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`bytes` is a `Uint8Array`, so the deck can come from a file upload, object storage, iCloud export, a browser file picker, or anywhere else your application gets bytes.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Why [`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote)
|
|
24
|
+
|
|
25
|
+
Keynote files are iWork packages. A PowerPoint parser will not read them.
|
|
26
|
+
|
|
27
|
+
[`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote) is a Keynote reader written for the same runtime as your application:
|
|
28
|
+
|
|
29
|
+
* **Pure TypeScript**
|
|
30
|
+
* **Keynote → 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 Keynote packages from their contents, not only the filename**
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## What it extracts
|
|
41
|
+
|
|
42
|
+
[`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote) opens the iWork archive, reads slide text storage from IWA protobuf, and rebuilds a shared document model.
|
|
43
|
+
|
|
44
|
+
The converter handles Keynote-specific concerns including:
|
|
45
|
+
|
|
46
|
+
* slide text in order
|
|
47
|
+
* titles and body copy
|
|
48
|
+
* lists
|
|
49
|
+
* tables on slides when present
|
|
50
|
+
|
|
51
|
+
The output is Markdown that can be searched, indexed, chunked, cached, or passed directly to an AI agent.
|
|
52
|
+
|
|
53
|
+
PowerPoint files are a different format. Use [`@mdgate/pptx`](https://github.com/mdgate/converters/tree/main/packages/pptx) for those.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Node.js
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { readFile } from 'node:fs/promises';
|
|
61
|
+
import { toMarkdown } from '@mdgate/keynote';
|
|
62
|
+
|
|
63
|
+
const bytes = new Uint8Array(await readFile('talk.key'));
|
|
64
|
+
const markdown = await toMarkdown(bytes);
|
|
65
|
+
|
|
66
|
+
console.log(markdown);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Browser
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { toMarkdown } from '@mdgate/keynote';
|
|
75
|
+
|
|
76
|
+
const file = input.files![0];
|
|
77
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
78
|
+
|
|
79
|
+
const markdown = await toMarkdown(bytes);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Cloudflare Workers and Edge runtimes
|
|
9
85
|
|
|
10
86
|
```ts
|
|
11
87
|
import { toMarkdown } from '@mdgate/keynote';
|
|
12
88
|
|
|
89
|
+
export default {
|
|
90
|
+
async fetch(request: Request) {
|
|
91
|
+
const bytes = new Uint8Array(await request.arrayBuffer());
|
|
92
|
+
const markdown = await toMarkdown(bytes);
|
|
93
|
+
|
|
94
|
+
return new Response(markdown, {
|
|
95
|
+
headers: {
|
|
96
|
+
'content-type': 'text/markdown; charset=utf-8',
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Format detection
|
|
106
|
+
|
|
107
|
+
You do not need to trust the file extension.
|
|
108
|
+
|
|
109
|
+
[`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote) recognizes Keynote iWork packages from ZIP / `Index.zip` contents.
|
|
110
|
+
|
|
111
|
+
```ts
|
|
13
112
|
const markdown = await toMarkdown(bytes);
|
|
14
113
|
```
|
|
15
114
|
|
|
16
|
-
|
|
115
|
+
A path can still be supplied as a format hint when [`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote) 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.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Compose it with other file readers
|
|
120
|
+
|
|
121
|
+
[`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote) implements the converter interface from [`@mdgate/core`](https://github.com/mdgate/converters/tree/main/packages/core).
|
|
17
122
|
|
|
18
123
|
```ts
|
|
19
124
|
import { create } from '@mdgate/core';
|
|
20
125
|
import { keynote } from '@mdgate/keynote';
|
|
126
|
+
import { pptx } from '@mdgate/pptx';
|
|
127
|
+
|
|
128
|
+
const read = create([
|
|
129
|
+
keynote(),
|
|
130
|
+
pptx(),
|
|
131
|
+
]);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The application still uses one reading interface while each format remains independently installable.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Need more than Keynote?
|
|
139
|
+
|
|
140
|
+
If your application needs to read many different file types, use the complete converter set:
|
|
21
141
|
|
|
22
|
-
|
|
142
|
+
```bash
|
|
143
|
+
npm install @mdgate/converters
|
|
23
144
|
```
|
|
24
145
|
|
|
25
|
-
|
|
26
|
-
|
|
146
|
+
```ts
|
|
147
|
+
import { toMarkdown } from '@mdgate/converters';
|
|
148
|
+
|
|
149
|
+
const markdown = await toMarkdown(bytes, {
|
|
150
|
+
path: filename,
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
[`@mdgate/keynote`](https://github.com/mdgate/converters/tree/main/packages/keynote) is one of the single-format packages in the open-source [`mdgate/converters`](https://github.com/mdgate/converters) project.
|
|
155
|
+
|
|
156
|
+
For AI agents, the same converter architecture can be used to extend `read_file` from text files to real-world document formats.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdgate/keynote",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "mdgate Apple Keynote converter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://convert.mdgate.dev",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/mdgate/converters.git",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"prepublishOnly": "bun run build"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@mdgate/core": "0.6.
|
|
32
|
-
"@mdgate/document": "0.6.
|
|
33
|
-
"@mdgate/iwork-common": "0.6.
|
|
34
|
-
"@mdgate/utils": "0.6.
|
|
31
|
+
"@mdgate/core": "0.6.9",
|
|
32
|
+
"@mdgate/document": "0.6.9",
|
|
33
|
+
"@mdgate/iwork-common": "0.6.9",
|
|
34
|
+
"@mdgate/utils": "0.6.9"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|