stream-markdown-parser 0.0.42 → 0.0.43

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/dist/index.js CHANGED
@@ -601,7 +601,7 @@ var require_markdown_it_task_checkbox = /* @__PURE__ */ __commonJS({ "../../node
601
601
  }) });
602
602
 
603
603
  //#endregion
604
- //#region ../../node_modules/.pnpm/markdown-it-ts@0.0.2/node_modules/markdown-it-ts/dist/chunk-Bp6m_JJh.js
604
+ //#region ../../node_modules/.pnpm/markdown-it-ts@0.0.3/node_modules/markdown-it-ts/dist/chunk-Bp6m_JJh.js
605
605
  var import_markdown_it_task_checkbox = /* @__PURE__ */ __toESM(require_markdown_it_task_checkbox(), 1);
606
606
  var __defProp = Object.defineProperty;
607
607
  var __export = (all) => {
@@ -2187,7 +2187,7 @@ var require_punycode = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pu
2187
2187
  }) });
2188
2188
 
2189
2189
  //#endregion
2190
- //#region ../../node_modules/.pnpm/markdown-it-ts@0.0.2/node_modules/markdown-it-ts/dist/index.js
2190
+ //#region ../../node_modules/.pnpm/markdown-it-ts@0.0.3/node_modules/markdown-it-ts/dist/index.js
2191
2191
  var import_punycode = /* @__PURE__ */ __toESM(require_punycode(), 1);
2192
2192
  var utils_exports = /* @__PURE__ */ __export({
2193
2193
  arrayReplaceAt: () => arrayReplaceAt,
@@ -5302,35 +5302,20 @@ var StateInline = class {
5302
5302
  const { src, posMax } = this;
5303
5303
  const marker = src.charCodeAt(start);
5304
5304
  let pos = start;
5305
- let count = 0;
5306
- while (pos < posMax && src.charCodeAt(pos) === marker) {
5307
- count++;
5308
- pos++;
5309
- }
5305
+ while (pos < posMax && src.charCodeAt(pos) === marker) pos++;
5306
+ const count = pos - start;
5310
5307
  if (count < 1) return null;
5311
5308
  const lastChar = start > 0 ? src.charCodeAt(start - 1) : 32;
5312
5309
  const nextChar = pos < posMax ? src.charCodeAt(pos) : 32;
5313
- const isLastPunctChar = lastChar === 32 || lastChar === 10;
5314
- const isNextPunctChar = nextChar === 32 || nextChar === 10;
5315
- const isLastWhiteSpace = lastChar === 32;
5316
- const isNextWhiteSpace = nextChar === 32;
5317
- let can_open = true;
5318
- let can_close = true;
5319
- if (isNextWhiteSpace) can_open = false;
5320
- else if (isNextPunctChar) {
5321
- if (!(isLastWhiteSpace || isLastPunctChar)) can_open = false;
5322
- }
5323
- if (isLastWhiteSpace) can_close = false;
5324
- else if (isLastPunctChar) {
5325
- if (!(isNextWhiteSpace || isNextPunctChar)) can_close = false;
5326
- }
5327
- if (!canSplitWord) {
5328
- can_open = can_open && (!isLastPunctChar || isLastWhiteSpace);
5329
- can_close = can_close && (!isNextPunctChar || isNextWhiteSpace);
5330
- }
5310
+ const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
5311
+ const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
5312
+ const isLastWhiteSpace = isWhiteSpace(lastChar);
5313
+ const isNextWhiteSpace = isWhiteSpace(nextChar);
5314
+ const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
5315
+ const right_flanking = !isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
5331
5316
  return {
5332
- can_open,
5333
- can_close,
5317
+ can_open: left_flanking && (canSplitWord || !right_flanking || isLastPunctChar),
5318
+ can_close: right_flanking && (canSplitWord || !left_flanking || isNextPunctChar),
5334
5319
  length: count
5335
5320
  };
5336
5321
  }