@mdgate/numbers 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 +26 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/numbers.d.ts +2 -0
- package/dist/to-markdown.d.ts +6 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @mdgate/numbers
|
|
2
|
+
|
|
3
|
+
Convert Apple Numbers spreadsheets to Markdown. Outputs GitHub-Flavored Markdown. Works in Node, Edge, and
|
|
4
|
+
browsers. No native addons.
|
|
5
|
+
|
|
6
|
+
Handles: `.numbers`
|
|
7
|
+
|
|
8
|
+
## Usage
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { toMarkdown } from '@mdgate/numbers';
|
|
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 { numbers } from '@mdgate/numbers';
|
|
21
|
+
|
|
22
|
+
const convert = create([numbers()]);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Part of [mdgate converters](https://github.com/mdgate/converters); install
|
|
26
|
+
`@mdgate/converters` for every format at once.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{documentToMarkdown as B}from"@mdgate/document";import{detectIWorkKind as I}from"@mdgate/iwork-common";import{fileExtension as A}from"@mdgate/utils";import{emptyDocument as b,heading as k,plain as T}from"@mdgate/document";import{collectDrawableBlocks as l,getObject as g,numbersSheets as D,openIWork as w,sheetsToDocument as x,TYPE as h,tableInfoToRows as y}from"@mdgate/iwork-common";function d(o){let e=w(o,"numbers"),p=D(e),f=[],s=b();for(let c of p){let t=[],r=[];for(let u of c.drawables){let n=g(e,u);if(n===void 0)continue;if(n.type===h.TST_TABLE_INFO||n.type===h.TST_WP_TABLE_INFO){let a=y(e,n.fields);if(a.length>0){if(t.length===0)t.push(...a);else r.push(...l(e,u));continue}}r.push(...l(e,u))}if(t.length>0)f.push({name:c.name,rows:t});if(r.length>0){if(p.length>1)s.blocks.push(k(2,[T(c.name)]));s.blocks.push(...r)}}let i=x(f);return i.blocks.push(...s.blocks),i}function m(){return{id:"numbers",sniff(o,e){if(I(o)==="numbers")return 2;if(e?.path!==void 0&&A(e.path)==="numbers")return 1;return 0},convert(o){return{markdown:B(d(o))}}}}import{create as C}from"@mdgate/core";var S=C([m()]);function _(o,e){return S(o,e)}export{_ as toMarkdown,m as numbers};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ConvertHint } from '@mdgate/core';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a single file's bytes to Markdown with the numbers 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/numbers",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "mdgate Apple Numbers 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
|
+
"numbers",
|
|
40
|
+
"iwork",
|
|
41
|
+
"apple"
|
|
42
|
+
]
|
|
43
|
+
}
|