@adobe/helix-importer 2.5.8 → 2.5.10
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 +1 -2
- package/src/importer/PageImporter.js +8 -39
- package/test/importers/PageImporter.spec.js +0 -1
- package/test/importers/fixtures/link.spec.html +0 -1
- package/test/importers/fixtures/link.spec.md +1 -3
- package/test/importers/fixtures/u.spec.md +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.5.10](https://github.com/adobe/helix-importer/compare/v2.5.9...v2.5.10) (2023-01-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* trigger releae ([d64999b](https://github.com/adobe/helix-importer/commit/d64999badb29281d1b2e2c14705af16dcbd78cbb))
|
|
7
|
+
|
|
8
|
+
## [2.5.9](https://github.com/adobe/helix-importer/compare/v2.5.8...v2.5.9) (2023-01-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Simplify underline handler ([0aa1b14](https://github.com/adobe/helix-importer/commit/0aa1b1434404fb6cf157f8ad548a627492b44e6b))
|
|
14
|
+
|
|
1
15
|
## [2.5.8](https://github.com/adobe/helix-importer/compare/v2.5.7...v2.5.8) (2023-01-19)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-importer",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.10",
|
|
4
4
|
"description": "Helix Importer tool: create md / docx from html",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"@adobe/remark-gridtables": "1.0.1",
|
|
53
53
|
"form-data": "4.0.0",
|
|
54
54
|
"fs-extra": "11.1.0",
|
|
55
|
-
"hast-util-to-html": "8.0.4",
|
|
56
55
|
"hast-util-to-mdast": "9.0.0",
|
|
57
56
|
"jsdom": "21.0.0",
|
|
58
57
|
"node-fetch": "3.3.0",
|
|
@@ -17,7 +17,6 @@ import { JSDOM } from 'jsdom';
|
|
|
17
17
|
import path from 'path';
|
|
18
18
|
import { unified } from 'unified';
|
|
19
19
|
import parse from 'rehype-parse';
|
|
20
|
-
import { toHtml } from 'hast-util-to-html';
|
|
21
20
|
import rehype2remark from 'rehype-remark';
|
|
22
21
|
import stringify from 'remark-stringify';
|
|
23
22
|
import fs from 'fs-extra';
|
|
@@ -66,47 +65,17 @@ export default class PageImporter {
|
|
|
66
65
|
.use(parse, { emitParseErrors: true })
|
|
67
66
|
.use(rehype2remark, {
|
|
68
67
|
handlers: {
|
|
69
|
-
hlxembed: (state, node) => {
|
|
70
|
-
const children = node.children.map((child) => processor.stringify(child).trim());
|
|
71
|
-
return {
|
|
72
|
-
type: 'paragraph',
|
|
73
|
-
children: [{
|
|
74
|
-
type: 'text',
|
|
75
|
-
value: children.join(''),
|
|
76
|
-
}],
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
68
|
u: (state, node) => {
|
|
80
69
|
if (node.children && node.children.length > 0) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
return processor.stringify(n).trim();
|
|
89
|
-
}
|
|
90
|
-
return processor.stringify(child).trim();
|
|
91
|
-
} catch (e) {
|
|
92
|
-
// cannot stringify the node, return html
|
|
93
|
-
return toHtml(child);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return {
|
|
70
|
+
return [{
|
|
71
|
+
type: 'html',
|
|
72
|
+
value: '<u>',
|
|
73
|
+
},
|
|
74
|
+
...state.all(node),
|
|
75
|
+
{
|
|
97
76
|
type: 'html',
|
|
98
|
-
value:
|
|
99
|
-
};
|
|
100
|
-
// todo: use this
|
|
101
|
-
// return [{
|
|
102
|
-
// type: 'html',
|
|
103
|
-
// value: '<u>',
|
|
104
|
-
// },
|
|
105
|
-
// ...state.all(node),
|
|
106
|
-
// {
|
|
107
|
-
// type: 'html',
|
|
108
|
-
// value: '</u>',
|
|
109
|
-
// }];
|
|
77
|
+
value: '</u>',
|
|
78
|
+
}];
|
|
110
79
|
}
|
|
111
80
|
return '';
|
|
112
81
|
},
|
|
@@ -147,7 +147,6 @@ describe('PageImporter tests - fixtures', () => {
|
|
|
147
147
|
|
|
148
148
|
const md = await storageHandler.get(results[0].md);
|
|
149
149
|
const expectedMD = await fs.readFile(path.resolve(__dirname, 'fixtures', `${feature}.spec.md`), 'utf-8');
|
|
150
|
-
console.log(md);
|
|
151
150
|
strictEqual(md.trim(), expectedMD.trim(), 'imported md is expected one');
|
|
152
151
|
};
|
|
153
152
|
|
|
@@ -8,10 +8,16 @@ Some normal text with random <u>underline</u> or <u>span with underline</u> or <
|
|
|
8
8
|
|
|
9
9
|
**<u>Underline 3</u>**
|
|
10
10
|
|
|
11
|
-
- <u>
|
|
12
|
-
|
|
11
|
+
- <u>
|
|
12
|
+
li underline 1
|
|
13
|
+
</u>
|
|
14
|
+
- <u>
|
|
15
|
+
li underline 2
|
|
16
|
+
</u>
|
|
13
17
|
also may have text here
|
|
14
|
-
- <u>
|
|
18
|
+
- <u>
|
|
19
|
+
li underline 3
|
|
20
|
+
</u>
|
|
15
21
|
|
|
16
22
|
[Unlined link](https:/www.sample.com/a) or [<u>Linked underline</u>](https:/www.sample.com/b) ?
|
|
17
23
|
|