@mdgate/visio 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 +137 -8
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -1,26 +1,155 @@
1
1
  # @mdgate/visio
2
2
 
3
- Convert Microsoft Visio drawings to Markdown. Outputs GitHub-Flavored Markdown. Works in Node, Edge,
4
- and browsers. No native addons.
3
+ **Convert Microsoft Visio drawings to Markdown in TypeScript.**
5
4
 
6
- Handles: `.vsd`, `.vsdx`, `.vss`, `.vst`, `.vssx`, `.vstx`
5
+ [`@mdgate/visio`](https://github.com/mdgate/converters/tree/main/packages/visio) reads `.vsd`, `.vsdx`, `.vss`, `.vst`, `.vssx`, and `.vstx` files directly in JavaScript and converts drawing text into GitHub-Flavored Markdown, without Python, native addons, WASM, or Visio.
7
6
 
8
- ## Usage
7
+ Works in **Node.js, Cloudflare Workers, Edge runtimes, and browsers**.
8
+
9
+ ```bash
10
+ npm install @mdgate/visio
11
+ ```
12
+
13
+ ```ts
14
+ import { toMarkdown } from '@mdgate/visio';
15
+
16
+ const markdown = await toMarkdown(bytes);
17
+ ```
18
+
19
+ `bytes` is a `Uint8Array`, so the drawing 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/visio`](https://github.com/mdgate/converters/tree/main/packages/visio)
24
+
25
+ Visio files hold process maps, network diagrams, and org charts. The useful content for an agent is usually the shape text, not a rendered image of the drawing.
26
+
27
+ [`@mdgate/visio`](https://github.com/mdgate/converters/tree/main/packages/visio) is a Visio reader written for the same runtime as your application:
28
+
29
+ * **Pure TypeScript**
30
+ * **Visio → 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 Visio packages and binary drawings from their contents, not only the filename**
37
+
38
+ ---
39
+
40
+ ## What it extracts
41
+
42
+ [`@mdgate/visio`](https://github.com/mdgate/converters/tree/main/packages/visio) parses VSDX ZIP packages and binary VSD OLE files.
43
+
44
+ The converter extracts readable text from shapes and pages. It is not a visual renderer of the diagram.
45
+
46
+ The output is Markdown that can be searched, indexed, chunked, cached, or passed directly to an AI agent.
47
+
48
+ ---
49
+
50
+ ## Node.js
51
+
52
+ ```ts
53
+ import { readFile } from 'node:fs/promises';
54
+ import { toMarkdown } from '@mdgate/visio';
55
+
56
+ const bytes = new Uint8Array(await readFile('network.vsdx'));
57
+ const markdown = await toMarkdown(bytes);
58
+
59
+ console.log(markdown);
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Browser
65
+
66
+ ```ts
67
+ import { toMarkdown } from '@mdgate/visio';
68
+
69
+ const file = input.files![0];
70
+ const bytes = new Uint8Array(await file.arrayBuffer());
71
+
72
+ const markdown = await toMarkdown(bytes);
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Cloudflare Workers and Edge runtimes
9
78
 
10
79
  ```ts
11
80
  import { toMarkdown } from '@mdgate/visio';
12
81
 
82
+ export default {
83
+ async fetch(request: Request) {
84
+ const bytes = new Uint8Array(await request.arrayBuffer());
85
+ const markdown = await toMarkdown(bytes);
86
+
87
+ return new Response(markdown, {
88
+ headers: {
89
+ 'content-type': 'text/markdown; charset=utf-8',
90
+ },
91
+ });
92
+ },
93
+ };
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Format detection
99
+
100
+ You do not need to trust the file extension.
101
+
102
+ [`@mdgate/visio`](https://github.com/mdgate/converters/tree/main/packages/visio) recognizes Visio ZIP packages and OLE drawings from their contents.
103
+
104
+ ```ts
13
105
  const markdown = await toMarkdown(bytes);
14
106
  ```
15
107
 
16
- Compose with other converters:
108
+ A path can still be supplied as a format hint when [`@mdgate/visio`](https://github.com/mdgate/converters/tree/main/packages/visio) 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.
109
+
110
+ ---
111
+
112
+ ## Compose it with other file readers
113
+
114
+ [`@mdgate/visio`](https://github.com/mdgate/converters/tree/main/packages/visio) implements the converter interface from [`@mdgate/core`](https://github.com/mdgate/converters/tree/main/packages/core).
17
115
 
18
116
  ```ts
19
117
  import { create } from '@mdgate/core';
20
118
  import { visio } from '@mdgate/visio';
119
+ import { pdf } from '@mdgate/pdf';
120
+
121
+ const read = create([
122
+ visio(),
123
+ pdf(),
124
+ ]);
125
+ ```
126
+
127
+ The application still uses one reading interface while each format remains independently installable.
128
+
129
+ ---
130
+
131
+ ## Need more than Visio?
132
+
133
+ If your application needs to read many different file types, use the complete converter set:
21
134
 
22
- const convert = create([visio()]);
135
+ ```bash
136
+ npm install @mdgate/converters
23
137
  ```
24
138
 
25
- Part of [mdgate converters](https://github.com/mdgate/converters); install
26
- `@mdgate/converters` for every format at once.
139
+ ```ts
140
+ import { toMarkdown } from '@mdgate/converters';
141
+
142
+ const markdown = await toMarkdown(bytes, {
143
+ path: filename,
144
+ });
145
+ ```
146
+
147
+ [`@mdgate/visio`](https://github.com/mdgate/converters/tree/main/packages/visio) is one of the single-format packages in the open-source [`mdgate/converters`](https://github.com/mdgate/converters) project.
148
+
149
+ For AI agents, the same converter architecture can be used to extend `read_file` from text files to real-world document formats.
150
+
151
+ ---
152
+
153
+ ## License
154
+
155
+ MIT
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@mdgate/visio",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "mdgate Visio converter (vsd/vsdx)",
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"