@ryangarber/markitdown-ts 0.1.4 → 0.2.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 CHANGED
@@ -10,11 +10,12 @@
10
10
  - Jupyter notebooks (`.ipynb`)
11
11
  - Word documents (`.docx`)
12
12
  - Excel workbooks (`.xlsx`)
13
+ - PowerPoint presentations (`.pptx`)
13
14
  - PDF documents (`.pdf`)
14
15
  - ZIP archives (`.zip`), with nested files converted recursively
15
16
  - Wikipedia, YouTube metadata, and Bing result pages supplied as HTML
16
17
 
17
- Audio, image metadata, local-path, and YouTube transcript features from the original project are intentionally left out because their implementations depended on runtime-specific modules, binaries, streams, or filesystem access. They may be added back over time as alternative implementations are found. Want to see one added? Contributions are welcome!
18
+ Audio, image metadata, local-path, and YouTube transcript features from the original project are intentionally left out because their implementations depended on runtime-specific modules, binaries, streams, or filesystem access. They may be added back over time as alternative implementations are found. Want to see one added? Contributions are welcome!
18
19
 
19
20
  ## Installation
20
21
 
@@ -29,22 +30,19 @@ import { MarkItDown } from "@ryangarber/markitdown-ts";
29
30
 
30
31
  const bytes: Uint8Array = /* plain bytes */;
31
32
 
32
- const result = await new MarkItDown().convert(bytes, {
33
- file_extension: ".txt"
34
- });
33
+ const result = await new MarkItDown().convert(bytes);
35
34
 
36
35
  console.log(result?.markdown);
37
36
  ```
38
37
 
39
38
  The same `convert` method accepts:
40
-
41
39
  - `Uint8Array`
42
40
  - `ArrayBuffer` and `SharedArrayBuffer`
43
- - `DataView` or any other typed array
41
+ - `DataView` or any other typed array
44
42
  - `Blob` and `File`
45
43
  - `Response`
46
44
 
47
- A `file_extension` is required when the source does not carry a recognized MIME type or filename.
45
+ The file type is detected from, in order: the `extension` option, a `File`'s name or a Content-Disposition filename, the URL's path (the `url` option and a `Response`'s URL), a `Blob`'s type or a Content-Type header, the content's magic number, and finally the content itself (HTML, XML, RSS, Atom, notebooks, and plain text). Each candidate is tried until one converts, so pass `extension` only when the content is ambiguous.
48
46
 
49
47
  ```ts
50
48
  const file = new File([docxBytes], "document.docx");
@@ -87,16 +85,30 @@ class MarkItDown {
87
85
 
88
86
  `convertBuffer` remains as a compatibility alias, but `convert(bytes, options)` is preferred.
89
87
 
88
+ ## CLI
89
+
90
+ The `markitdown` command converts a file and prints its Markdown:
91
+
92
+ ```sh
93
+ npx @ryangarber/markitdown-ts report.docx
94
+ markitdown --extension html page # when the type can't be detected
95
+ markitdown report.pdf --json # print { title, markdown }
96
+ ```
97
+
98
+ To use it without Node, download the standalone build for your system (`markitdown-darwin-arm64`, `markitdown-darwin-x64`, `markitdown-linux-arm64`, `markitdown-linux-x64`, `markitdown-win32-arm64.exe` or `markitdown-win32-x64.exe`) from the [latest release](https://github.com/ryangarber/markitdown-ts/releases/latest), or build it from source with `pnpm build:cli` (needs [Bun](https://bun.sh)).
99
+
90
100
  ## Development
91
101
 
92
102
  ```sh
93
103
  pnpm install
94
- pnpm check
104
+ pnpm lint
105
+ pnpm typecheck
95
106
  pnpm test --run
96
- pnpm build
107
+ pnpm build # library, CLI and man page
108
+ pnpm build:cli # standalone binaries (needs Bun)
97
109
  ```
98
110
 
99
- Biome handles both formatting and linting. `tsup` produces ESM, CommonJS, source maps, and declarations in `dist`.
111
+ Biome handles both formatting and linting. `tsdown` produces ESM, CommonJS, source maps, and declarations in `dist`. Releases are cut by [rylease](https://github.com/ryangarber/rylease) from conventional commits: pushes to `main` dry-run the release, and dispatching the `release` workflow on `main` publishes to npm and attaches the CLI binaries to the GitHub release.
100
112
 
101
113
  ## License
102
114