@adobe/helix-html-pipeline 3.11.21 → 3.11.22
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 +1 -1
- package/src/steps/rewrite-icons.js +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.11.22](https://github.com/adobe/helix-html-pipeline/compare/v3.11.21...v3.11.22) (2023-07-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* ignore urns, hrefs, code blocks for rewrite-icons ([#355](https://github.com/adobe/helix-html-pipeline/issues/355)) ([8d1bd78](https://github.com/adobe/helix-html-pipeline/commit/8d1bd785a9e8b4c9f187167ca9e0f958eef328c9)), closes [#348](https://github.com/adobe/helix-html-pipeline/issues/348)
|
|
7
|
+
|
|
1
8
|
## [3.11.21](https://github.com/adobe/helix-html-pipeline/compare/v3.11.20...v3.11.21) (2023-07-18)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/* eslint-disable no-param-reassign */
|
|
13
13
|
import { h } from 'hastscript';
|
|
14
|
-
import { CONTINUE, visit } from 'unist-util-visit';
|
|
14
|
+
import { CONTINUE, SKIP, visit } from 'unist-util-visit';
|
|
15
15
|
|
|
16
|
-
const REGEXP_ICON =
|
|
16
|
+
const REGEXP_ICON = /(?<!(?:https?|urn)[^\s]*):(#?[a-z_-]+[a-z\d]*):/gi;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a <span> icon element:
|
|
@@ -44,9 +44,13 @@ function createIcon(value) {
|
|
|
44
44
|
export default function rewrite({ content }) {
|
|
45
45
|
const { hast } = content;
|
|
46
46
|
visit(hast, (node, idx, parent) => {
|
|
47
|
+
if (node.tagName === 'code') {
|
|
48
|
+
return SKIP;
|
|
49
|
+
}
|
|
47
50
|
if (node.type !== 'text') {
|
|
48
51
|
return CONTINUE;
|
|
49
52
|
}
|
|
53
|
+
|
|
50
54
|
const text = node.value;
|
|
51
55
|
let lastIdx = 0;
|
|
52
56
|
for (const match of text.matchAll(REGEXP_ICON)) {
|