@ryangarber/markitdown-ts 0.1.5 → 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 +21 -10
- package/dist/cli.mjs +423 -328
- package/dist/index.cjs +788 -645
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -34
- package/dist/index.d.ts +19 -34
- package/dist/index.js +398 -316
- package/dist/index.js.map +1 -1
- package/dist/markitdown.1 +30 -0
- package/package.json +39 -21
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
|
-
type ConverterResult = {
|
|
3
|
-
title: string | null;
|
|
4
|
-
markdown: string;
|
|
5
|
-
/** @deprecated Use `markdown` instead. */
|
|
6
|
-
text_content: string;
|
|
7
|
-
} | null;
|
|
8
1
|
/**
|
|
9
2
|
* In-memory inputs supported by the conversion API.
|
|
10
3
|
*
|
|
@@ -12,46 +5,38 @@ type ConverterResult = {
|
|
|
12
5
|
* array buffers, shared array buffers, blobs, and files are normalized to it.
|
|
13
6
|
*/
|
|
14
7
|
type ByteSource = Uint8Array | ArrayBufferLike | ArrayBufferView | Blob;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
/**
|
|
9
|
+
* All supported input types for the conversion API.
|
|
10
|
+
*/
|
|
11
|
+
type ConverterSource = ByteSource | Response | URL | string;
|
|
12
|
+
type ConverterOptions<Options = unknown> = Options & {
|
|
13
|
+
/** Original file extension, with or without a leading dot. */
|
|
14
|
+
extension?: string;
|
|
18
15
|
/** Original URL, used by site-specific HTML converters. */
|
|
19
16
|
url?: string;
|
|
20
17
|
/** Override the global fetch implementation. */
|
|
21
18
|
fetch?: typeof fetch;
|
|
22
|
-
/**
|
|
23
|
-
styleMap?: string | string[];
|
|
24
|
-
includeEmbeddedStyleMap?: boolean;
|
|
25
|
-
includeDefaultStyleMap?: boolean;
|
|
26
|
-
ignoreEmptyParagraphs?: boolean;
|
|
27
|
-
idPrefix?: string;
|
|
28
|
-
transformDocument?: (element: unknown) => unknown;
|
|
29
|
-
_parent_converters?: DocumentConverter[];
|
|
19
|
+
/** Enable debug logging. */
|
|
30
20
|
debug?: boolean;
|
|
21
|
+
/** @internal Parent converters. */
|
|
22
|
+
_converters?: Converter[];
|
|
31
23
|
};
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
type ConverterResult = {
|
|
25
|
+
title: string | null;
|
|
26
|
+
markdown: string;
|
|
27
|
+
} | null;
|
|
28
|
+
interface Converter<Options = unknown> {
|
|
29
|
+
convert(source: Uint8Array, options: ConverterOptions<Options>): Promise<ConverterResult>;
|
|
34
30
|
}
|
|
35
|
-
|
|
36
|
-
//#region src/markitdown.d.ts
|
|
37
|
-
type ConversionSource = ByteSource | Response | URL | string;
|
|
38
|
-
declare class MarkItDown {
|
|
31
|
+
export declare class MarkItDown {
|
|
39
32
|
private readonly converters;
|
|
40
33
|
constructor();
|
|
41
34
|
/** Convert a URL, response, blob, array buffer, data view, or typed array. */
|
|
42
|
-
convert(source:
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Pass the byte source directly to `convert`.
|
|
45
|
-
*/
|
|
46
|
-
convertBuffer(source: ByteSource, options: ConverterOptions & {
|
|
47
|
-
file_extension: string;
|
|
48
|
-
}): Promise<ConverterResult>;
|
|
35
|
+
convert(source: ConverterSource, options?: ConverterOptions): Promise<ConverterResult>;
|
|
49
36
|
private convertUrl;
|
|
50
37
|
private convertResponse;
|
|
51
38
|
private convertBytes;
|
|
52
|
-
private addExtension;
|
|
53
39
|
private registerConverter;
|
|
54
40
|
}
|
|
55
|
-
|
|
56
|
-
export { type ByteSource, type ConversionSource, type ConverterOptions, type ConverterResult, type DocumentConverter, MarkItDown };
|
|
41
|
+
export type { ByteSource, Converter, ConverterOptions, ConverterResult, ConverterSource };
|
|
57
42
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
|
-
type ConverterResult = {
|
|
3
|
-
title: string | null;
|
|
4
|
-
markdown: string;
|
|
5
|
-
/** @deprecated Use `markdown` instead. */
|
|
6
|
-
text_content: string;
|
|
7
|
-
} | null;
|
|
8
1
|
/**
|
|
9
2
|
* In-memory inputs supported by the conversion API.
|
|
10
3
|
*
|
|
@@ -12,46 +5,38 @@ type ConverterResult = {
|
|
|
12
5
|
* array buffers, shared array buffers, blobs, and files are normalized to it.
|
|
13
6
|
*/
|
|
14
7
|
type ByteSource = Uint8Array | ArrayBufferLike | ArrayBufferView | Blob;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
/**
|
|
9
|
+
* All supported input types for the conversion API.
|
|
10
|
+
*/
|
|
11
|
+
type ConverterSource = ByteSource | Response | URL | string;
|
|
12
|
+
type ConverterOptions<Options = unknown> = Options & {
|
|
13
|
+
/** Original file extension, with or without a leading dot. */
|
|
14
|
+
extension?: string;
|
|
18
15
|
/** Original URL, used by site-specific HTML converters. */
|
|
19
16
|
url?: string;
|
|
20
17
|
/** Override the global fetch implementation. */
|
|
21
18
|
fetch?: typeof fetch;
|
|
22
|
-
/**
|
|
23
|
-
styleMap?: string | string[];
|
|
24
|
-
includeEmbeddedStyleMap?: boolean;
|
|
25
|
-
includeDefaultStyleMap?: boolean;
|
|
26
|
-
ignoreEmptyParagraphs?: boolean;
|
|
27
|
-
idPrefix?: string;
|
|
28
|
-
transformDocument?: (element: unknown) => unknown;
|
|
29
|
-
_parent_converters?: DocumentConverter[];
|
|
19
|
+
/** Enable debug logging. */
|
|
30
20
|
debug?: boolean;
|
|
21
|
+
/** @internal Parent converters. */
|
|
22
|
+
_converters?: Converter[];
|
|
31
23
|
};
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
type ConverterResult = {
|
|
25
|
+
title: string | null;
|
|
26
|
+
markdown: string;
|
|
27
|
+
} | null;
|
|
28
|
+
interface Converter<Options = unknown> {
|
|
29
|
+
convert(source: Uint8Array, options: ConverterOptions<Options>): Promise<ConverterResult>;
|
|
34
30
|
}
|
|
35
|
-
|
|
36
|
-
//#region src/markitdown.d.ts
|
|
37
|
-
type ConversionSource = ByteSource | Response | URL | string;
|
|
38
|
-
declare class MarkItDown {
|
|
31
|
+
export declare class MarkItDown {
|
|
39
32
|
private readonly converters;
|
|
40
33
|
constructor();
|
|
41
34
|
/** Convert a URL, response, blob, array buffer, data view, or typed array. */
|
|
42
|
-
convert(source:
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Pass the byte source directly to `convert`.
|
|
45
|
-
*/
|
|
46
|
-
convertBuffer(source: ByteSource, options: ConverterOptions & {
|
|
47
|
-
file_extension: string;
|
|
48
|
-
}): Promise<ConverterResult>;
|
|
35
|
+
convert(source: ConverterSource, options?: ConverterOptions): Promise<ConverterResult>;
|
|
49
36
|
private convertUrl;
|
|
50
37
|
private convertResponse;
|
|
51
38
|
private convertBytes;
|
|
52
|
-
private addExtension;
|
|
53
39
|
private registerConverter;
|
|
54
40
|
}
|
|
55
|
-
|
|
56
|
-
export { type ByteSource, type ConversionSource, type ConverterOptions, type ConverterResult, type DocumentConverter, MarkItDown };
|
|
41
|
+
export type { ByteSource, Converter, ConverterOptions, ConverterResult, ConverterSource };
|
|
57
42
|
//# sourceMappingURL=index.d.ts.map
|