@tryghost/helpers 1.1.81 → 1.1.83

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/cjs/helpers.js CHANGED
@@ -3551,7 +3551,7 @@ function countWords(text) {
3551
3551
  text = text.string;
3552
3552
  }
3553
3553
 
3554
- text = text.replace(/<(.|\n)*?>/g, ' '); // strip any HTML tags
3554
+ text = text.replace(/<("[^"]*"|'[^']*'|[^'">])+\/?>/g, ' '); // strip any HTML tags
3555
3555
 
3556
3556
  const pattern = /[a-zA-ZÀ-ÿ0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
3557
3557
 
@@ -3590,7 +3590,7 @@ function countImages(html) {
3590
3590
  if (Object.prototype.hasOwnProperty.call(html, 'string')) {
3591
3591
  html = html.string;
3592
3592
  }
3593
- return (html.match(/<img(.|\n)*?>/g) || []).length;
3593
+ return (html.match(/<img("[^"]*"|'[^']*'|[^'">])+\/?>/g) || []).length;
3594
3594
  }
3595
3595
 
3596
3596
  function estimatedReadingTimeInMinutes({wordCount, imageCount}) {
package/es/helpers.js CHANGED
@@ -3544,7 +3544,7 @@ function countWords(text) {
3544
3544
  if (Object.prototype.hasOwnProperty.call(text, 'string')) {
3545
3545
  text = text.string;
3546
3546
  }
3547
- text = text.replace(/<(.|\n)*?>/g, ' '); // strip any HTML tags
3547
+ text = text.replace(/<("[^"]*"|'[^']*'|[^'">])+\/?>/g, ' '); // strip any HTML tags
3548
3548
 
3549
3549
  const pattern = /[a-zA-ZÀ-ÿ0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
3550
3550
  const RTLPattern = /([\u0600-\u06ff]+|[\u0591-\u05F4]+)/g;
@@ -3577,7 +3577,7 @@ function countImages(html) {
3577
3577
  if (Object.prototype.hasOwnProperty.call(html, 'string')) {
3578
3578
  html = html.string;
3579
3579
  }
3580
- return (html.match(/<img(.|\n)*?>/g) || []).length;
3580
+ return (html.match(/<img("[^"]*"|'[^']*'|[^'">])+\/?>/g) || []).length;
3581
3581
  }
3582
3582
 
3583
3583
  function estimatedReadingTimeInMinutes(_ref) {