@adobe/helix-html-pipeline 6.28.1 → 6.28.2
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,10 @@
|
|
|
1
|
+
## [6.28.2](https://github.com/adobe/helix-html-pipeline/compare/v6.28.1...v6.28.2) (2026-04-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* multiple regressions ([#1066](https://github.com/adobe/helix-html-pipeline/issues/1066)) ([e66aa9f](https://github.com/adobe/helix-html-pipeline/commit/e66aa9f13eaec74fdd4520591c4533e7fd5bee77))
|
|
7
|
+
|
|
1
8
|
## [6.28.1](https://github.com/adobe/helix-html-pipeline/compare/v6.28.0...v6.28.1) (2026-04-08)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { toString } from 'hast-util-to-string';
|
|
13
|
-
import { SKIP, visit } from 'unist-util-visit';
|
|
13
|
+
import { CONTINUE, SKIP, visit } from 'unist-util-visit';
|
|
14
14
|
import { toMetaName } from '../utils/modifiers.js';
|
|
15
15
|
import { toBlockCSSClassNames } from './utils.js';
|
|
16
16
|
|
|
@@ -29,6 +29,31 @@ function isSectionMetadataEnabled(config) {
|
|
|
29
29
|
return new Date(config.created) >= new Date('2026-05-01');
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Extracts a value from a HAST node by looking for image src or link href attributes.
|
|
34
|
+
* Falls back to text content if no images or links are found.
|
|
35
|
+
* @param {object} $value the HAST value node
|
|
36
|
+
* @returns {string} the extracted value
|
|
37
|
+
*/
|
|
38
|
+
function getValueFromNode($value) {
|
|
39
|
+
const urls = [];
|
|
40
|
+
visit($value, (node) => {
|
|
41
|
+
if (node.tagName === 'img' && node.properties?.src) {
|
|
42
|
+
urls.push(node.properties.src);
|
|
43
|
+
return SKIP;
|
|
44
|
+
}
|
|
45
|
+
if (node.tagName === 'a' && node.properties?.href) {
|
|
46
|
+
urls.push(node.properties.href);
|
|
47
|
+
return SKIP;
|
|
48
|
+
}
|
|
49
|
+
return CONTINUE;
|
|
50
|
+
});
|
|
51
|
+
if (urls.length) {
|
|
52
|
+
return urls.join(',');
|
|
53
|
+
}
|
|
54
|
+
return toString($value).trim();
|
|
55
|
+
}
|
|
56
|
+
|
|
32
57
|
/**
|
|
33
58
|
* Processes section metadata blocks by applying their key/value pairs
|
|
34
59
|
* as data attributes on the parent section div, with special handling
|
|
@@ -53,12 +78,14 @@ export default function extractSectionMetadata(state) {
|
|
|
53
78
|
const [$name, $value] = $row.children;
|
|
54
79
|
const name = toMetaName(toString($name));
|
|
55
80
|
if (name) {
|
|
56
|
-
const value =
|
|
81
|
+
const value = getValueFromNode($value);
|
|
57
82
|
if (name === 'style') {
|
|
58
83
|
if (!parent.properties.className) {
|
|
59
84
|
parent.properties.className = [];
|
|
60
85
|
}
|
|
61
|
-
parent.properties.className.push(
|
|
86
|
+
parent.properties.className.push(
|
|
87
|
+
...value.split(/[,\s]+/).filter(Boolean).flatMap(toBlockCSSClassNames),
|
|
88
|
+
);
|
|
62
89
|
} else {
|
|
63
90
|
parent.properties[`data-${name}`] = value;
|
|
64
91
|
}
|