@mdgate/keynote 0.1.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 ADDED
@@ -0,0 +1,26 @@
1
+ # @mdgate/keynote
2
+
3
+ Convert Apple Keynote presentations to Markdown. Outputs GitHub-Flavored Markdown. Works in Node, Edge, and
4
+ browsers. No native addons.
5
+
6
+ Handles: `.key`
7
+
8
+ ## Usage
9
+
10
+ ```ts
11
+ import { toMarkdown } from '@mdgate/keynote';
12
+
13
+ const markdown = await toMarkdown(bytes);
14
+ ```
15
+
16
+ Compose with other converters:
17
+
18
+ ```ts
19
+ import { create } from '@mdgate/core';
20
+ import { keynote } from '@mdgate/keynote';
21
+
22
+ const convert = create([keynote()]);
23
+ ```
24
+
25
+ Part of [mdgate converters](https://github.com/mdgate/converters); install
26
+ `@mdgate/converters` for every format at once.
@@ -0,0 +1,2 @@
1
+ export { keynote } from './keynote.js';
2
+ export { toMarkdown } from './to-markdown.js';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{documentToMarkdown as B}from"@mdgate/document";import{detectIWorkKind as C}from"@mdgate/iwork-common";import{fileExtension as D}from"@mdgate/utils";import{emptyDocument as R,heading as U,inlinesAreEmpty as V,inlinesToPlainText as X,plain as Y}from"@mdgate/document";import{keynoteSlides as Z,openIWork as _,slideToBlocks as $}from"@mdgate/iwork-common";function O(z){let q=_(z,"keynote"),F=R(),H=Z(q);for(let G=0;G<H.length;G+=1){let Q=H[G],L=$(q,Q),N=A(L);if(N!==void 0)F.blocks.push(N);else if(H.length>1)F.blocks.push(U(2,[Y(`Slide ${G+1}`)]));F.blocks.push(...L)}return F}function A(z){if(z.length===0)return;let q=z[0];if(q.type==="heading")return z.shift(),q;if(q.type==="paragraph"&&!V(q.inlines))return z.shift(),{type:"heading",level:2,anchor:X(q.inlines),content:q.inlines};return}function J(){return{id:"keynote",sniff(z,q){if(C(z)==="keynote")return 2;if(q?.path!==void 0&&D(q.path)==="key")return 1;return 0},convert(z){return{markdown:B(O(z))}}}}import{create as K}from"@mdgate/core";var M=K([J()]);function S(z,q){return M(z,q)}export{S as toMarkdown,J as keynote};
@@ -0,0 +1,2 @@
1
+ import type { Converter } from '@mdgate/core';
2
+ export declare function keynote(): Converter;
@@ -0,0 +1,6 @@
1
+ import { type ConvertHint } from '@mdgate/core';
2
+ /**
3
+ * Convert a single file's bytes to Markdown with the keynote converter.
4
+ * `hint.path` is only a sniff hint; it is never read from disk.
5
+ */
6
+ export declare function toMarkdown(bytes: Uint8Array, hint?: ConvertHint): Promise<string>;
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@mdgate/keynote",
3
+ "version": "0.1.0",
4
+ "description": "mdgate Apple Keynote converter",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "files": [
17
+ "dist/**/*.js",
18
+ "dist/**/*.d.ts"
19
+ ],
20
+ "scripts": {
21
+ "build": "bun ../../scripts/build-package.ts",
22
+ "prepublishOnly": "bun run build"
23
+ },
24
+ "dependencies": {
25
+ "@mdgate/core": "0.1.3",
26
+ "@mdgate/document": "0.1.0",
27
+ "@mdgate/iwork-common": "0.1.0",
28
+ "@mdgate/utils": "0.1.2"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "engines": {
34
+ "node": ">=20"
35
+ },
36
+ "keywords": [
37
+ "mdgate",
38
+ "markdown",
39
+ "keynote",
40
+ "iwork",
41
+ "apple"
42
+ ]
43
+ }