marked 7.0.2 → 7.0.3

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/lib/marked.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * marked v7.0.2 - a markdown parser
2
+ * marked v7.0.3 - a markdown parser
3
3
  * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -842,7 +842,8 @@
842
842
  return;
843
843
  const nextChar = match[1] || match[2] || '';
844
844
  if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
845
- const lLength = match[0].length - 1;
845
+ // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
846
+ const lLength = [...match[0]].length - 1;
846
847
  let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
847
848
  const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
848
849
  endReg.lastIndex = 0;
@@ -852,7 +853,7 @@
852
853
  rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
853
854
  if (!rDelim)
854
855
  continue; // skip single * in __abc*abc__
855
- rLength = rDelim.length;
856
+ rLength = [...rDelim].length;
856
857
  if (match[3] || match[4]) { // found another Left Delim
857
858
  delimTotal += rLength;
858
859
  continue;
@@ -868,7 +869,7 @@
868
869
  continue; // Haven't found enough closing delimiters
869
870
  // Remove extra characters. *a*** -> *a*
870
871
  rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
871
- const raw = src.slice(0, lLength + match.index + rLength + 1);
872
+ const raw = [...src].slice(0, lLength + match.index + rLength + 1).join('');
872
873
  // Create `em` if smallest delimiter has odd char count. *a***
873
874
  if (Math.min(lLength, rLength) % 2) {
874
875
  const text = raw.slice(1, -1);