@markitdownjs/shared 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 +65 -0
  3. package/package.json +1 -1
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,65 @@
1
+ # @markitdownjs/shared
2
+
3
+ [![npm](https://img.shields.io/npm/v/@markitdownjs/shared)](https://www.npmjs.com/package/@markitdownjs/shared)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Internal package providing base types, AST node definitions, error classes, MIME type utilities, and DOM polyfills shared across all MarkItDownJS packages.
7
+
8
+ > **Note:** This is an internal package. Most users should install [`@markitdownjs/core`](../core) instead.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @markitdownjs/shared
14
+ ```
15
+
16
+ ## Key Exports
17
+
18
+ ### AST Node Types
19
+
20
+ | Export | Description |
21
+ |---|---|
22
+ | `DocumentNode` | Root node of the AST |
23
+ | `HeadingNode` | Heading element (h1–h6) |
24
+ | `ParagraphNode` | Block of text |
25
+ | `TableNode` | Table with headers and rows |
26
+ | `ImageNode` | Image with alt text and src |
27
+ | `CodeNode` | Inline or fenced code block |
28
+ | `ListNode` | Ordered or unordered list |
29
+ | `SectionNode` | Logical document section |
30
+
31
+ ### Pipeline Types
32
+
33
+ | Export | Description |
34
+ |---|---|
35
+ | `ConversionResult` | Output of a converter: `{ markdown, ast, metadata }` |
36
+ | `ConversionInput` | Input to a converter: `{ source, mimeType, options? }` |
37
+
38
+ ### Errors
39
+
40
+ | Export | Description |
41
+ |---|---|
42
+ | `MarkItDownError` | Base error class for all MarkItDownJS errors |
43
+
44
+ ### Utilities
45
+
46
+ | Export | Description |
47
+ |---|---|
48
+ | `MimeTypeUtils` | MIME type detection, normalization, and extension mapping |
49
+
50
+ ## Usage
51
+
52
+ ```ts
53
+ import {
54
+ DocumentNode,
55
+ ConversionResult,
56
+ MarkItDownError,
57
+ MimeTypeUtils,
58
+ } from "@markitdownjs/shared";
59
+
60
+ const mime = MimeTypeUtils.fromExtension("pdf"); // "application/pdf"
61
+ ```
62
+
63
+ ---
64
+
65
+ Part of the [MarkItDownJS](https://github.com/markitdownjs/markitdownjs) monorepo.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markitdownjs/shared",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Shared types, AST nodes, and utilities for MarkItDownJS",
5
5
  "license": "MIT",
6
6
  "type": "module",