@adobe/helix-importer 2.9.16 → 2.9.18

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [2.9.18](https://github.com/adobe/helix-importer/compare/v2.9.17...v2.9.18) (2023-08-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * properly escape tilde ([#190](https://github.com/adobe/helix-importer/issues/190)) ([9853f17](https://github.com/adobe/helix-importer/commit/9853f17b9feeba52f910baeb6834f8c08ea5df08)), closes [#189](https://github.com/adobe/helix-importer/issues/189)
7
+
8
+ ## [2.9.17](https://github.com/adobe/helix-importer/compare/v2.9.16...v2.9.17) (2023-07-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency @adobe/helix-md2docx to v2.1.17 ([#195](https://github.com/adobe/helix-importer/issues/195)) ([bd7d92e](https://github.com/adobe/helix-importer/commit/bd7d92e0ad744688a5ab6f421194945a461a3611))
14
+
1
15
  ## [2.9.16](https://github.com/adobe/helix-importer/compare/v2.9.15...v2.9.16) (2023-07-27)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-importer",
3
- "version": "2.9.16",
3
+ "version": "2.9.18",
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.2",
29
- "@adobe/helix-docx2md": "1.4.11",
30
- "@adobe/helix-mediahandler": "2.2.6",
29
+ "@adobe/helix-docx2md": "1.4.12",
30
+ "@adobe/helix-mediahandler": "2.2.7",
31
31
  "@semantic-release/changelog": "6.0.3",
32
32
  "@semantic-release/exec": "6.0.3",
33
33
  "@semantic-release/git": "10.0.1",
34
- "c8": "8.0.0",
34
+ "c8": "8.0.1",
35
35
  "dirname-filename-esm": "1.1.1",
36
- "eslint": "8.45.0",
36
+ "eslint": "8.46.0",
37
37
  "husky": "8.0.3",
38
38
  "lint-staged": "13.2.3",
39
39
  "mocha": "10.2.0",
@@ -44,14 +44,14 @@
44
44
  "license": "Apache-2.0",
45
45
  "dependencies": {
46
46
  "@adobe/helix-markdown-support": "6.3.0",
47
- "@adobe/helix-md2docx": "2.1.16",
47
+ "@adobe/helix-md2docx": "2.1.18",
48
48
  "@adobe/mdast-util-gridtables": "2.0.2",
49
49
  "@adobe/remark-gridtables": "1.0.4",
50
50
  "form-data": "4.0.0",
51
51
  "fs-extra": "11.1.1",
52
52
  "hast-util-to-mdast": "9.0.0",
53
53
  "jsdom": "22.1.0",
54
- "node-fetch": "3.3.1",
54
+ "node-fetch": "3.3.2",
55
55
  "rehype-parse": "8.0.4",
56
56
  "rehype-remark": "github:adobe-rnd/rehype-remark#45735e80a3d3c805d3c4211ae035f718ddd10bcb",
57
57
  "remark-stringify": "10.0.3",
@@ -99,7 +99,8 @@ export default class PageImporter {
99
99
  ruleSpaces: false,
100
100
  });
101
101
 
102
- const file = await processor.process(resource.document.innerHTML);
102
+ const html = resource.document.innerHTML;
103
+ const file = await processor.process(html);
103
104
  let contents = String(file);
104
105
 
105
106
  // process image links
@@ -191,7 +192,6 @@ export default class PageImporter {
191
192
  this.cleanup(document);
192
193
  DOMUtils.reviewHeadings(document);
193
194
  DOMUtils.reviewParagraphs(document);
194
- DOMUtils.escapeSpecialCharacters(document);
195
195
  [
196
196
  'b',
197
197
  'a',
@@ -113,11 +113,6 @@ export default class DOMUtils {
113
113
  }
114
114
  }
115
115
 
116
- static escapeSpecialCharacters(document) {
117
- // eslint-disable-next-line no-param-reassign
118
- document.body.innerHTML = document.body.innerHTML.replace(/~/gm, '\\~');
119
- }
120
-
121
116
  static reviewHeadings(document) {
122
117
  const tags = [...document.querySelectorAll('h1, h2, h3, h4, h5, h6')];
123
118
  for (let i = tags.length - 1; i >= 0; i -= 1) {
@@ -20,7 +20,7 @@ export default class MDUtils {
20
20
  };
21
21
 
22
22
  static cleanupMarkdown(md) {
23
- let ret = md?.replace(/\\\\~/gm, '\\~');
23
+ let ret = md;
24
24
  if (ret) {
25
25
  for (let i = 0; i < 20; i += 1) {
26
26
  let x = `${i}`;
@@ -178,6 +178,10 @@ describe('PageImporter tests - fixtures', () => {
178
178
  await featureTest('space');
179
179
  });
180
180
 
181
+ it('import - s', async () => {
182
+ await featureTest('s');
183
+ });
184
+
181
185
  it('import - sub and sup', async () => {
182
186
  await featureTest('subsup');
183
187
  });
@@ -6,4 +6,4 @@
6
6
 
7
7
  http://wwww.sample.com/c
8
8
 
9
- [Weird link](https://www.sample.com/app/answers/detail/a_id/17414//\~/axon%E2%84%A2-pclamp%E2%AE-and-digidata%E2%84%A2%3A-operating-system-compatibility#:\\\\\~:text=Digidata%201440%2C%201550%2C%201550A%2C,supported%20up%20to%20pCLAMP%2010.3.\&text=MiniDigi%201B%20is%20required%20for%20use%20under%2064%2Dbit%20Operating%20Systems.\&text=pCLAMP%209%20software%20is%20not,or%2064%2Dbit%20versions)
9
+ [Weird link](https://www.sample.com/app/answers/detail/a_id/17414//~/axon%E2%84%A2-pclamp%E2%AE-and-digidata%E2%84%A2%3A-operating-system-compatibility#:\\\\~:text=Digidata%201440%2C%201550%2C%201550A%2C,supported%20up%20to%20pCLAMP%2010.3.\&text=MiniDigi%201B%20is%20required%20for%20use%20under%2064%2Dbit%20Operating%20Systems.\&text=pCLAMP%209%20software%20is%20not,or%2064%2Dbit%20versions)
@@ -10,5 +10,6 @@
10
10
  <span>US$59.99/mo</span>&nbsp;per license
11
11
  </b>
12
12
  </p>
13
+ <p>Text with ~tilde.</p>
13
14
  </body>
14
- </html>
15
+ </html>
@@ -4,4 +4,6 @@
4
4
 
5
5
  removed ~~strikethrough 2~~ but added insert 3
6
6
 
7
- **~~US$84.99/mo~~ US$59.99/mo per license**
7
+ **~~US$84.99/mo~~ US$59.99/mo per license**
8
+
9
+ Text with \~tilde.
@@ -130,18 +130,6 @@ describe('DOMUtils#reviewHeadings tests', () => {
130
130
  });
131
131
  });
132
132
 
133
- describe('DOMUtils#escapeSpecialCharacters tests', () => {
134
- const test = (input, expected) => {
135
- const { document } = (new JSDOM(input)).window;
136
- DOMUtils.escapeSpecialCharacters(document);
137
- strictEqual(document.body.innerHTML, expected);
138
- };
139
-
140
- it('escapeSpecialCharacters escape tidles', () => {
141
- test('<p>Paragraph with 2 tildes: 20~30 and 40~50</p>', '<p>Paragraph with 2 tildes: 20\\~30 and 40\\~50</p>');
142
- });
143
- });
144
-
145
133
  describe('DOMUtils#remove tests', () => {
146
134
  const test = (input, selectors, expected) => {
147
135
  const { document } = (new JSDOM(input)).window;
@@ -80,14 +80,6 @@ describe('MDUtils#cleanupMarkdown tests', () => {
80
80
  );
81
81
  });
82
82
 
83
- it('MDUtils#cleanupMarkdown unescape tildes', () => {
84
- strictEqual(
85
- MDUtils.cleanupMarkdown('#A title\n~~Tilde can be an pb~~\n Especially \\\\~in the content'),
86
- '#A title\n~~Tilde can be an pb~~\n Especially \\~in the content',
87
- 'unescape tildes',
88
- );
89
- });
90
-
91
83
  it('MDUtils#cleanupMarkdown replace weird spaces', () => {
92
84
  strictEqual(
93
85
  MDUtils.cleanupMarkdown('#A title\nReplaces the weird spaces characters: "\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019"'),