@adobe/helix-md2docx 1.1.0 → 1.2.3
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 +10 -11
- package/src/cli/convert2docx.js +1 -33
- package/src/mdast2docx/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [1.2.3](https://github.com/adobe/helix-md2docx/compare/v1.2.2...v1.2.3) (2022-01-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* avoid dirname_esm ([#14](https://github.com/adobe/helix-md2docx/issues/14)) ([f5eda2f](https://github.com/adobe/helix-md2docx/commit/f5eda2f41ce0ccec0f1ac9e30780140a8def6435))
|
|
7
|
+
|
|
8
|
+
## [1.2.2](https://github.com/adobe/helix-md2docx/compare/v1.2.1...v1.2.2) (2022-01-24)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-docx2md to v1.0.6 ([#13](https://github.com/adobe/helix-md2docx/issues/13)) ([6ffcee4](https://github.com/adobe/helix-md2docx/commit/6ffcee4f5e5c3b2da6fd0625554dfeeb49b91525))
|
|
14
|
+
|
|
15
|
+
## [1.2.1](https://github.com/adobe/helix-md2docx/compare/v1.2.0...v1.2.1) (2022-01-24)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **deps:** update dependency @adobe/helix-markdown-support to v3.1.2 ([#12](https://github.com/adobe/helix-md2docx/issues/12)) ([6a95f1b](https://github.com/adobe/helix-md2docx/commit/6a95f1bca73db0814812cc03d33372887367eb7a))
|
|
21
|
+
|
|
22
|
+
# [1.2.0](https://github.com/adobe/helix-md2docx/compare/v1.1.0...v1.2.0) (2022-01-20)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* move cli to get rid of the mediahanlder dep ([b7e8349](https://github.com/adobe/helix-md2docx/commit/b7e8349a0a2e0d06ad9f95b6287a3322e9bba9d9))
|
|
28
|
+
|
|
1
29
|
# [1.1.0](https://github.com/adobe/helix-md2docx/compare/v1.0.3...v1.1.0) (2022-01-19)
|
|
2
30
|
|
|
3
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-md2docx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Helix Service that converts markdown to word documents",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,13 +28,11 @@
|
|
|
28
28
|
"homepage": "https://github.com/adobe/helix-md2docx#readme",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@adobe/helix-fetch": "3.0.0",
|
|
31
|
-
"@adobe/helix-markdown-support": "3.1.
|
|
31
|
+
"@adobe/helix-markdown-support": "3.1.2",
|
|
32
32
|
"@adobe/helix-shared-process-queue": "1.1.0",
|
|
33
|
-
"@adobe/helix-docx2md": "1.0.
|
|
34
|
-
"@adobe/helix-mediahandler": "1.0.1",
|
|
35
|
-
"dirname-filename-esm": "1.1.1",
|
|
33
|
+
"@adobe/helix-docx2md": "1.0.6",
|
|
36
34
|
"docx": "7.3.0",
|
|
37
|
-
"hast-util-is-element": "2.1.
|
|
35
|
+
"hast-util-is-element": "2.1.2",
|
|
38
36
|
"hast-util-to-mdast": "8.3.0",
|
|
39
37
|
"image-size": "1.0.1",
|
|
40
38
|
"rehype-parse": "8.0.3",
|
|
@@ -45,23 +43,24 @@
|
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
45
|
"@adobe/eslint-config-helix": "1.3.2",
|
|
46
|
+
"@adobe/helix-mediahandler": "1.0.2",
|
|
48
47
|
"@semantic-release/changelog": "6.0.1",
|
|
49
48
|
"@semantic-release/exec": "6.0.3",
|
|
50
49
|
"@semantic-release/git": "10.0.1",
|
|
51
50
|
"c8": "7.11.0",
|
|
52
51
|
"chai": "4.3.4",
|
|
53
52
|
"codecov": "3.8.3",
|
|
54
|
-
"dotenv": "14.
|
|
55
|
-
"eslint": "8.
|
|
53
|
+
"dotenv": "14.2.0",
|
|
54
|
+
"eslint": "8.7.0",
|
|
56
55
|
"eslint-plugin-header": "3.1.1",
|
|
57
56
|
"eslint-plugin-import": "2.25.4",
|
|
58
57
|
"fs-extra": "10.0.0",
|
|
59
58
|
"husky": "7.0.4",
|
|
60
59
|
"junit-report-builder": "3.0.0",
|
|
61
|
-
"lint-staged": "12.
|
|
62
|
-
"mocha": "9.1.
|
|
60
|
+
"lint-staged": "12.2.2",
|
|
61
|
+
"mocha": "9.1.4",
|
|
63
62
|
"mocha-multi-reporters": "1.5.1",
|
|
64
|
-
"semantic-release": "
|
|
63
|
+
"semantic-release": "19.0.2",
|
|
65
64
|
"unist-util-inspect": "7.0.0"
|
|
66
65
|
},
|
|
67
66
|
"lint-staged": {
|
package/src/cli/convert2docx.js
CHANGED
|
@@ -15,39 +15,9 @@ import {
|
|
|
15
15
|
readdir, readFile, stat, writeFile,
|
|
16
16
|
} from 'fs/promises';
|
|
17
17
|
import path from 'path';
|
|
18
|
-
import { MediaHandler } from '@adobe/helix-mediahandler';
|
|
19
18
|
import { docx2md } from '@adobe/helix-docx2md';
|
|
20
19
|
import { md2docx } from '../index.js';
|
|
21
20
|
|
|
22
|
-
class MockMediaHandler extends MediaHandler {
|
|
23
|
-
constructor(params) {
|
|
24
|
-
super({
|
|
25
|
-
owner: 'owner',
|
|
26
|
-
repo: 'repo',
|
|
27
|
-
ref: 'ref',
|
|
28
|
-
contentBusId: 'dummyId',
|
|
29
|
-
...params,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// eslint-disable-next-line class-methods-use-this
|
|
34
|
-
async checkBlobExists() {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// eslint-disable-next-line class-methods-use-this
|
|
39
|
-
async getBlob(uri) {
|
|
40
|
-
return {
|
|
41
|
-
contentType: 'image/png',
|
|
42
|
-
uri,
|
|
43
|
-
meta: {
|
|
44
|
-
width: '32',
|
|
45
|
-
height: '32',
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
21
|
async function run(filePath) {
|
|
52
22
|
// eslint-disable-next-line no-param-reassign
|
|
53
23
|
filePath = path.resolve(process.cwd(), filePath);
|
|
@@ -76,9 +46,7 @@ async function run(filePath) {
|
|
|
76
46
|
|
|
77
47
|
// convert back for verification
|
|
78
48
|
console.log(`verifying ${path.relative(process.cwd(), fileDocx)} -> ${path.relative(process.cwd(), fileMD)}`);
|
|
79
|
-
const newMD = await docx2md(buffer, {
|
|
80
|
-
mediaHandler: new MockMediaHandler(),
|
|
81
|
-
});
|
|
49
|
+
const newMD = await docx2md(buffer, {});
|
|
82
50
|
await writeFile(fileMD, newMD, 'utf-8');
|
|
83
51
|
}
|
|
84
52
|
}
|
package/src/mdast2docx/index.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { readFile } from 'fs/promises';
|
|
13
|
+
import url from 'url';
|
|
13
14
|
import path from 'path';
|
|
14
|
-
import { dirname } from 'dirname-filename-esm';
|
|
15
15
|
import docx from 'docx';
|
|
16
16
|
|
|
17
17
|
import all from './all.js';
|
|
@@ -25,7 +25,7 @@ import downloadImages from './mdast-download-images.js';
|
|
|
25
25
|
const { Document, Packer } = docx;
|
|
26
26
|
|
|
27
27
|
// eslint-disable-next-line no-underscore-dangle
|
|
28
|
-
const __dirname = dirname(import.meta);
|
|
28
|
+
const __dirname = url.fileURLToPath ? path.dirname(url.fileURLToPath(import.meta.url)) : './';
|
|
29
29
|
|
|
30
30
|
export default async function mdast2docx(mdast, log = console) {
|
|
31
31
|
const ctx = {
|