@adobe/helix-docx2md 1.0.3 → 1.0.7
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/CHANGELOG.md +28 -0
- package/package.json +12 -14
- package/src/index.d.ts +4 -7
- package/src/index.js +4 -11
- package/src/mdast2md/mdast-process-images.js +4 -29
- package/src/mdast2md/mdast2md.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [1.0.7](https://github.com/adobe/helix-docx2md/compare/v1.0.6...v1.0.7) (2022-02-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency @adobe/helix-shared-process-queue to v1.1.1 ([cbbfbf1](https://github.com/adobe/helix-docx2md/commit/cbbfbf187fc41b4b5a7b8ce4c698f5fd3610662f))
|
|
7
|
+
|
|
8
|
+
## [1.0.6](https://github.com/adobe/helix-docx2md/compare/v1.0.5...v1.0.6) (2022-01-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-markdown-support to v3.1.2 ([#13](https://github.com/adobe/helix-docx2md/issues/13)) ([2ea396f](https://github.com/adobe/helix-docx2md/commit/2ea396f2d4b05608b2e9bbb7debe86da6fb949ca))
|
|
14
|
+
|
|
15
|
+
## [1.0.5](https://github.com/adobe/helix-docx2md/compare/v1.0.4...v1.0.5) (2022-01-17)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* remove leftover code ([#8](https://github.com/adobe/helix-docx2md/issues/8)) ([9f294f6](https://github.com/adobe/helix-docx2md/commit/9f294f6293cd970504467b557ea50249a7b65490))
|
|
21
|
+
|
|
22
|
+
## [1.0.4](https://github.com/adobe/helix-docx2md/compare/v1.0.3...v1.0.4) (2022-01-17)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* proper exports ([#7](https://github.com/adobe/helix-docx2md/issues/7)) ([e57c70a](https://github.com/adobe/helix-docx2md/commit/e57c70ac04904f5fedee629fbd019edcb8532235))
|
|
28
|
+
|
|
1
29
|
## [1.0.3](https://github.com/adobe/helix-docx2md/compare/v1.0.2...v1.0.3) (2022-01-15)
|
|
2
30
|
|
|
3
31
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-docx2md",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Helix library that converts word documents to markdown",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
|
-
"
|
|
7
|
+
"_exports": {
|
|
8
8
|
".": "./src/index.js",
|
|
9
|
-
"./
|
|
10
|
-
"./mdast2md": "./src/mdast2md/mdast2md.js",
|
|
9
|
+
"./dast2mdast": "./src/dast2mdast/docx2mdast.js",
|
|
11
10
|
"./docx2dast": "./src/docx2dast/docx2dast.js",
|
|
11
|
+
"./mdast2md": "./src/mdast2md/mdast2md.js",
|
|
12
12
|
"./docx2md": "./src/docx2md.js"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
@@ -34,14 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/adobe/helix-docx2md#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@adobe/helix-markdown-support": "3.1.
|
|
38
|
-
"@adobe/helix-shared-process-queue": "1.1.
|
|
37
|
+
"@adobe/helix-markdown-support": "3.1.2",
|
|
38
|
+
"@adobe/helix-shared-process-queue": "1.1.1",
|
|
39
39
|
"@adobe/mammoth": "1.4.15-bleeding.1",
|
|
40
40
|
"dirname-filename-esm": "1.1.1",
|
|
41
|
-
"image-size": "1.0.1",
|
|
42
41
|
"mdast-util-to-markdown": "1.2.6",
|
|
43
42
|
"mdast-util-to-string": "3.1.0",
|
|
44
|
-
"mime": "3.0.0",
|
|
45
43
|
"remark-gfm": "3.0.1",
|
|
46
44
|
"remark-parse": "10.0.1",
|
|
47
45
|
"remark-stringify": "10.0.2",
|
|
@@ -52,22 +50,22 @@
|
|
|
52
50
|
},
|
|
53
51
|
"devDependencies": {
|
|
54
52
|
"@adobe/eslint-config-helix": "1.3.2",
|
|
55
|
-
"@adobe/helix-mediahandler": "1.0.
|
|
53
|
+
"@adobe/helix-mediahandler": "1.0.3",
|
|
56
54
|
"@semantic-release/changelog": "6.0.1",
|
|
57
55
|
"@semantic-release/exec": "6.0.3",
|
|
58
56
|
"@semantic-release/git": "10.0.1",
|
|
59
57
|
"c8": "7.11.0",
|
|
60
58
|
"codecov": "3.8.3",
|
|
61
|
-
"dotenv": "
|
|
62
|
-
"eslint": "8.
|
|
59
|
+
"dotenv": "15.0.0",
|
|
60
|
+
"eslint": "8.8.0",
|
|
63
61
|
"eslint-plugin-header": "3.1.1",
|
|
64
62
|
"eslint-plugin-import": "2.25.4",
|
|
65
63
|
"husky": "7.0.4",
|
|
66
64
|
"junit-report-builder": "3.0.0",
|
|
67
|
-
"lint-staged": "12.
|
|
68
|
-
"mocha": "9.
|
|
65
|
+
"lint-staged": "12.3.2",
|
|
66
|
+
"mocha": "9.2.0",
|
|
69
67
|
"mocha-multi-reporters": "1.5.1",
|
|
70
|
-
"semantic-release": "
|
|
68
|
+
"semantic-release": "19.0.2",
|
|
71
69
|
"unist-util-inspect": "7.0.0"
|
|
72
70
|
},
|
|
73
71
|
"lint-staged": {
|
package/src/index.d.ts
CHANGED
|
@@ -9,10 +9,7 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export default
|
|
16
|
-
docx2mdast,
|
|
17
|
-
mdast2markdown,
|
|
18
|
-
};
|
|
12
|
+
export { default as dast2mdast } from './dast2mdast/dast2mdast.js';
|
|
13
|
+
export { default as docx2dast } from './docx2dast/docx2dast.js';
|
|
14
|
+
export { default as mdast2md } from './mdast2md/mdast2md.js';
|
|
15
|
+
export { default as docx2md } from './docx2md.js';
|
package/src/index.js
CHANGED
|
@@ -9,14 +9,7 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
docx2dast,
|
|
19
|
-
dast2mdast,
|
|
20
|
-
mdast2md,
|
|
21
|
-
docx2md,
|
|
22
|
-
};
|
|
12
|
+
export { default as dast2mdast } from './dast2mdast/dast2mdast.js';
|
|
13
|
+
export { default as docx2dast } from './docx2dast/docx2dast.js';
|
|
14
|
+
export { default as mdast2md } from './mdast2md/mdast2md.js';
|
|
15
|
+
export { default as docx2md } from './docx2md.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
/* eslint-disable no-param-reassign */
|
|
13
13
|
import assert from 'assert';
|
|
14
14
|
import { visit } from 'unist-util-visit';
|
|
15
|
-
import mime from 'mime';
|
|
16
15
|
import processQueue from '@adobe/helix-shared-process-queue';
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -42,33 +41,9 @@ async function getBlob(handler, data, contentType, source) {
|
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
? handler.createExternalResource(data, data.length, contentType, source)
|
|
49
|
-
: await handler.createExternalResourceFromStream(data.stream, data.size, contentType, source);
|
|
50
|
-
|
|
51
|
-
let suffix = '';
|
|
52
|
-
if (blob.contentType && !blob.uri.startsWith('data:')) {
|
|
53
|
-
const types = blob.contentType.split('/');
|
|
54
|
-
let ext = mime.getExtension(blob.contentType);
|
|
55
|
-
// handle wrong jpg content-type
|
|
56
|
-
if (!ext && blob.contentType === 'image/jpg') {
|
|
57
|
-
ext = 'jpg';
|
|
58
|
-
}
|
|
59
|
-
if (ext && ext !== 'bin') {
|
|
60
|
-
suffix = `#${types[0]}.${ext}`;
|
|
61
|
-
}
|
|
62
|
-
if (blob.meta && blob.meta.width && blob.meta.height) {
|
|
63
|
-
suffix = `${suffix}?width=${blob.meta.width}&width=${blob.meta.height}`;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
blob.uri = `${blob.uri}${suffix}`;
|
|
67
|
-
} else {
|
|
68
|
-
blob = data instanceof Buffer
|
|
69
|
-
? handler.createMediaResource(data, data.length, contentType, source)
|
|
70
|
-
: await handler.createMediaResourceFromStream(data.stream, data.size, contentType, source);
|
|
71
|
-
}
|
|
44
|
+
const blob = data instanceof Buffer
|
|
45
|
+
? handler.createMediaResource(data, data.length, contentType, source)
|
|
46
|
+
: await handler.createMediaResourceFromStream(data.stream, data.size, contentType, source);
|
|
72
47
|
const exists = await handler.checkBlobExists(blob);
|
|
73
48
|
if (!exists) {
|
|
74
49
|
await handler.upload(blob);
|
|
@@ -34,4 +34,4 @@ export declare interface MDast2mdOptions {
|
|
|
34
34
|
* @param {string} [opts.source] the source document
|
|
35
35
|
* @returns {Promise<string>} the markdown representation.
|
|
36
36
|
*/
|
|
37
|
-
export function mdast2md(mdast: object, opts: MDast2mdOptions): Promise<string>;
|
|
37
|
+
export default function mdast2md(mdast: object, opts: MDast2mdOptions): Promise<string>;
|