@markitdownjs/react 0.1.0 → 0.1.1

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/package.json +3 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 MarkItDownJS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @markitdownjs/react
2
+
3
+ [![npm](https://img.shields.io/npm/v/@markitdownjs/react)](https://www.npmjs.com/package/@markitdownjs/react)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ React hooks and components for document conversion in browser and React apps. Part of [MarkItDownJS](https://github.com/markitdownjs/markitdownjs).
7
+
8
+ **Peer dependency:** `react >= 18.0.0`
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @markitdownjs/react @markitdownjs/core
14
+ npm install react react-dom # peer dependencies
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ import { useDocumentParser } from "@markitdownjs/react";
21
+
22
+ function UploadPage() {
23
+ const { convert, result, loading, error } = useDocumentParser();
24
+
25
+ return (
26
+ <input
27
+ type="file"
28
+ onChange={(e) => convert(e.target.files![0])}
29
+ />
30
+ );
31
+ }
32
+ ```
33
+
34
+ ## API
35
+
36
+ ### `useDocumentParser(options?)`
37
+
38
+ Returns `{ convert, result, loading, error, reset }`.
39
+
40
+ ### `useMarkdownConversion(source, mimeType)`
41
+
42
+ Returns `{ markdown, loading, error }` — converts a source directly to a Markdown string.
43
+
44
+ ### `useDocumentChunks(source, mimeType, options?)`
45
+
46
+ Returns `{ chunks, loading, error }` — splits the converted document into chunked nodes, useful for RAG pipelines.
47
+
48
+ ### `DocumentProvider`
49
+
50
+ Context provider. Wrap your app to share a single `MarkItDown` instance and registered converters across all hooks.
51
+
52
+ ```tsx
53
+ import { DocumentProvider } from "@markitdownjs/react";
54
+ import { JsonConverter } from "@markitdownjs/json";
55
+
56
+ <DocumentProvider converters={[new JsonConverter()]}>
57
+ <App />
58
+ </DocumentProvider>
59
+ ```
60
+
61
+ ## Part of the MarkItDownJS Monorepo
62
+
63
+ [https://github.com/markitdownjs/markitdownjs](https://github.com/markitdownjs/markitdownjs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markitdownjs/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React hooks and components for MarkItDownJS document conversion",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@markitdownjs/shared": "0.1.0"
20
+ "@markitdownjs/shared": "0.1.1"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=18.0.0"
@@ -26,7 +26,7 @@
26
26
  "typescript": "^5.5.0",
27
27
  "react": "^18.2.0",
28
28
  "@types/react": "^18.2.0",
29
- "@markitdownjs/core": "0.1.0"
29
+ "@markitdownjs/core": "0.1.1"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsc --project tsconfig.json",