@adobe/helix-md2docx 1.1.0 → 1.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/CHANGELOG.md +7 -0
- package/package.json +2 -2
- package/src/cli/convert2docx.js +1 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.2.0](https://github.com/adobe/helix-md2docx/compare/v1.1.0...v1.2.0) (2022-01-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* move cli to get rid of the mediahanlder dep ([b7e8349](https://github.com/adobe/helix-md2docx/commit/b7e8349a0a2e0d06ad9f95b6287a3322e9bba9d9))
|
|
7
|
+
|
|
1
8
|
# [1.1.0](https://github.com/adobe/helix-md2docx/compare/v1.0.3...v1.1.0) (2022-01-19)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-md2docx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Helix Service that converts markdown to word documents",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"@adobe/helix-markdown-support": "3.1.1",
|
|
32
32
|
"@adobe/helix-shared-process-queue": "1.1.0",
|
|
33
33
|
"@adobe/helix-docx2md": "1.0.5",
|
|
34
|
-
"@adobe/helix-mediahandler": "1.0.1",
|
|
35
34
|
"dirname-filename-esm": "1.1.1",
|
|
36
35
|
"docx": "7.3.0",
|
|
37
36
|
"hast-util-is-element": "2.1.1",
|
|
@@ -45,6 +44,7 @@
|
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@adobe/eslint-config-helix": "1.3.2",
|
|
47
|
+
"@adobe/helix-mediahandler": "1.0.1",
|
|
48
48
|
"@semantic-release/changelog": "6.0.1",
|
|
49
49
|
"@semantic-release/exec": "6.0.3",
|
|
50
50
|
"@semantic-release/git": "10.0.1",
|
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
|
}
|