@adobe/helix-importer 2.5.16 → 2.7.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 +14 -0
- package/package.json +5 -5
- package/src/importer/HTML2x.js +8 -2
- package/test/importers/HTML2x.spec.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [2.7.0](https://github.com/adobe/helix-importer/compare/v2.6.0...v2.7.0) (2023-02-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* allow from property ([#92](https://github.com/adobe/helix-importer/issues/92)) ([91f9681](https://github.com/adobe/helix-importer/commit/91f96812ce8062d860f57fa38d1795b8df242c55))
|
|
7
|
+
|
|
8
|
+
# [2.6.0](https://github.com/adobe/helix-importer/compare/v2.5.16...v2.6.0) (2023-01-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* transform can be async ([#88](https://github.com/adobe/helix-importer/issues/88)) ([9441e0e](https://github.com/adobe/helix-importer/commit/9441e0e8494d4f3c49a62712144e8082f85e2320))
|
|
14
|
+
|
|
1
15
|
## [2.5.16](https://github.com/adobe/helix-importer/compare/v2.5.15...v2.5.16) (2023-01-29)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-importer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Helix Importer tool: create md / docx from html",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@adobe/eslint-config-helix": "2.0.1",
|
|
29
|
-
"@adobe/helix-docx2md": "1.3.
|
|
30
|
-
"@adobe/helix-mediahandler": "2.0.
|
|
29
|
+
"@adobe/helix-docx2md": "1.3.14",
|
|
30
|
+
"@adobe/helix-mediahandler": "2.0.6",
|
|
31
31
|
"@semantic-release/changelog": "6.0.2",
|
|
32
32
|
"@semantic-release/exec": "6.0.3",
|
|
33
33
|
"@semantic-release/git": "10.0.1",
|
|
34
34
|
"c8": "7.12.0",
|
|
35
35
|
"dirname-filename-esm": "1.1.1",
|
|
36
|
-
"eslint": "8.
|
|
36
|
+
"eslint": "8.33.0",
|
|
37
37
|
"husky": "8.0.3",
|
|
38
38
|
"lint-staged": "13.1.0",
|
|
39
39
|
"mocha": "10.2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"license": "Apache-2.0",
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@adobe/helix-markdown-support": "6.1.1",
|
|
47
|
-
"@adobe/helix-md2docx": "2.0.
|
|
47
|
+
"@adobe/helix-md2docx": "2.0.39",
|
|
48
48
|
"@adobe/mdast-util-gridtables": "1.0.6",
|
|
49
49
|
"@adobe/remark-gridtables": "1.0.2",
|
|
50
50
|
"form-data": "4.0.0",
|
package/src/importer/HTML2x.js
CHANGED
|
@@ -79,7 +79,7 @@ async function html2x(
|
|
|
79
79
|
// for more advanced use cases, give access to the original dom with
|
|
80
80
|
// no preprocessing at all
|
|
81
81
|
if (transformer.preprocess) {
|
|
82
|
-
transformer.preprocess({
|
|
82
|
+
await transformer.preprocess({
|
|
83
83
|
url,
|
|
84
84
|
document: doc,
|
|
85
85
|
html: doc.documentElement.outerHTML,
|
|
@@ -99,7 +99,7 @@ async function html2x(
|
|
|
99
99
|
|
|
100
100
|
async process(document) {
|
|
101
101
|
if (transformer.transform) {
|
|
102
|
-
let results = transformer.transform({
|
|
102
|
+
let results = await transformer.transform({
|
|
103
103
|
url,
|
|
104
104
|
document,
|
|
105
105
|
html,
|
|
@@ -120,6 +120,8 @@ async function html2x(
|
|
|
120
120
|
|
|
121
121
|
if (result.element) {
|
|
122
122
|
extra.html = result.element.outerHTML;
|
|
123
|
+
} else if (result.from) {
|
|
124
|
+
extra.from = result.from;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
if (result.report) {
|
|
@@ -190,6 +192,10 @@ async function html2x(
|
|
|
190
192
|
res.html = pir.extra.html;
|
|
191
193
|
}
|
|
192
194
|
|
|
195
|
+
if (pir.extra.from) {
|
|
196
|
+
res.from = pir.extra.from;
|
|
197
|
+
}
|
|
198
|
+
|
|
193
199
|
if (pir.extra.report) {
|
|
194
200
|
res.report = pir.extra.report;
|
|
195
201
|
}
|
|
@@ -234,6 +234,7 @@ describe('html2md tests', () => {
|
|
|
234
234
|
const out = await html2md('https://www.sample.com/page.html', '<html><body><h1>Hello World</h1></body></html>', {
|
|
235
235
|
transform: () => [{
|
|
236
236
|
path: '/my-custom-path-p1',
|
|
237
|
+
from: 'https://www.sample.com/page.html',
|
|
237
238
|
report: {
|
|
238
239
|
custom: 'A custom property',
|
|
239
240
|
customArray: ['a', 'b', 'c'],
|
|
@@ -253,6 +254,7 @@ describe('html2md tests', () => {
|
|
|
253
254
|
strictEqual(out.md, undefined);
|
|
254
255
|
strictEqual(out.docx, undefined);
|
|
255
256
|
strictEqual(out.path, '/my-custom-path-p1');
|
|
257
|
+
strictEqual(out.from, 'https://www.sample.com/page.html');
|
|
256
258
|
ok(out.report);
|
|
257
259
|
strictEqual(out.report.custom, 'A custom property');
|
|
258
260
|
deepStrictEqual(out.report.customArray, ['a', 'b', 'c']);
|