@adobe/helix-html-pipeline 3.11.9 → 3.11.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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## [3.11.10](https://github.com/adobe/helix-html-pipeline/compare/v3.11.9...v3.11.10) (2023-06-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * coverage ([#326](https://github.com/adobe/helix-html-pipeline/issues/326)) ([31a34b9](https://github.com/adobe/helix-html-pipeline/commit/31a34b96a5ed01c002e9951507712904f8ff5615))
7
+ * output image title attribute ([3893776](https://github.com/adobe/helix-html-pipeline/commit/3893776a5b6ce786e69e9475dc148955a634d719)), closes [#308](https://github.com/adobe/helix-html-pipeline/issues/308)
8
+
1
9
  ## [3.11.9](https://github.com/adobe/helix-html-pipeline/compare/v3.11.8...v3.11.9) (2023-05-25)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "3.11.9",
3
+ "version": "3.11.10",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -90,7 +90,7 @@
90
90
  "esmock": "2.2.3",
91
91
  "husky": "8.0.3",
92
92
  "js-yaml": "4.1.0",
93
- "jsdom": "22.0.0",
93
+ "jsdom": "22.1.0",
94
94
  "junit-report-builder": "3.0.1",
95
95
  "lint-staged": "13.2.2",
96
96
  "mocha": "10.2.0",
@@ -18,7 +18,7 @@ const BREAK_POINTS = [
18
18
  { width: '750' },
19
19
  ];
20
20
 
21
- export function createOptimizedPicture(src, alt = '') {
21
+ export function createOptimizedPicture(src, alt = '', title = undefined) {
22
22
  const url = new URL(src, 'https://localhost/');
23
23
  const { pathname, hash = '' } = url;
24
24
  const props = new URLSearchParams(hash.substring(1));
@@ -55,6 +55,7 @@ export function createOptimizedPicture(src, alt = '') {
55
55
  return h('img', {
56
56
  loading: 'lazy',
57
57
  alt,
58
+ 'data-title': title === alt ? undefined : title,
58
59
  type: v.type,
59
60
  src: srcset,
60
61
  width,
@@ -78,8 +79,8 @@ export default async function createPictures({ content }) {
78
79
  const { hast } = content;
79
80
 
80
81
  visitParents(hast, isMediaImage, (img, parents) => {
81
- const { src, alt } = img.properties;
82
- const picture = createOptimizedPicture(src, alt);
82
+ const { src, alt, title } = img.properties;
83
+ const picture = createOptimizedPicture(src, alt, title);
83
84
 
84
85
  // check if parent has style and unwrap if needed
85
86
  const parent = parents[parents.length - 1];