kordoc 4.25.20 → 4.25.21

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.
Files changed (109) hide show
  1. package/README.md +2 -2
  2. package/dist/{chunk-NJ4XKLJ2.js → chunk-24LB25LZ.js} +2 -2
  3. package/dist/{chunk-2PG66APB.js → chunk-3AYNFK6J.js} +2 -2
  4. package/dist/{chunk-3PP4Z3FP.js → chunk-5MDRUEHP.js} +3 -3
  5. package/dist/{chunk-BADCOPJC.js → chunk-5ULHNZ3P.js} +3 -3
  6. package/dist/{chunk-Y5SKJKIK.js → chunk-6I3X54AQ.js} +2 -2
  7. package/dist/{chunk-XPCPNLPL.js → chunk-6MCJHRSM.js} +2 -2
  8. package/dist/{chunk-LWH2LXGF.js → chunk-COJYQKGH.js} +6 -4
  9. package/dist/{chunk-LWH2LXGF.js.map → chunk-COJYQKGH.js.map} +2 -2
  10. package/dist/{chunk-SXCZLQWK.js → chunk-DHXKCDAU.js} +50 -6
  11. package/dist/chunk-DHXKCDAU.js.map +7 -0
  12. package/dist/{chunk-3VFPOZUF.js → chunk-DZOA5N5W.js} +2 -2
  13. package/dist/{chunk-C23CZCN2.js → chunk-FDSFXE2L.js} +2 -2
  14. package/dist/{chunk-JOVWROSN.js → chunk-GJORKM42.js} +2 -2
  15. package/dist/{chunk-53HOCVFW.js → chunk-HQILGS2O.js} +2 -2
  16. package/dist/{chunk-YL5NXWPG.js → chunk-KW4JO5CV.js} +3 -3
  17. package/dist/{chunk-YAJUYPG6.js → chunk-LSUTK3DH.js} +2 -2
  18. package/dist/{chunk-74PQK4BH.js → chunk-MWCJYIJC.js} +19 -19
  19. package/dist/{chunk-Q2IBOGTT.js → chunk-PFNZQ3XI.js} +2 -2
  20. package/dist/{chunk-OJL2KWEP.js → chunk-PVOLFVXE.js} +2 -2
  21. package/dist/{chunk-N4G253GI.js → chunk-QNJ2LMUO.js} +8 -8
  22. package/dist/{chunk-4AHUE7MM.js → chunk-QOCUFTT4.js} +4 -4
  23. package/dist/{chunk-FL3O63DT.js → chunk-S553BW45.js} +6 -6
  24. package/dist/{chunk-2RRYYIDJ.js → chunk-TI6S3KZF.js} +2 -2
  25. package/dist/{chunk-W24M3GRV.js → chunk-TYJSNW4Z.js} +55 -46
  26. package/dist/chunk-TYJSNW4Z.js.map +7 -0
  27. package/dist/{chunk-CCJ66IWE.js → chunk-W5AHXAUP.js} +6 -6
  28. package/dist/{chunk-P74JR5PT.js → chunk-XUBBFY3H.js} +5 -5
  29. package/dist/{chunk-YKPC2V2D.js → chunk-ZCMMU34Z.js} +2 -2
  30. package/dist/{chunk-4JIM5KIE.js → chunk-ZO4P735U.js} +2 -2
  31. package/dist/chunks-XX7RHVQF.js +10 -0
  32. package/dist/cli.js +37 -37
  33. package/dist/{formula-ZLRIPWXH.js → formula-HMKT4BZL.js} +4 -4
  34. package/dist/{generator-TQUJJGL2.js → generator-HOY4SZ26.js} +7 -7
  35. package/dist/{hancom-ET5G25Y3.js → hancom-QWJBWOOE.js} +2 -2
  36. package/dist/{image-ocr-PINHNXEM.js → image-ocr-P5AIZNT3.js} +11 -11
  37. package/dist/index.cjs +86 -36
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.js +21 -21
  40. package/dist/mcp.js +33 -33
  41. package/dist/memo-Q7772VJD.js +15 -0
  42. package/dist/{model-bundle-PHN7MCDR.js → model-bundle-5CXCIZHZ.js} +5 -5
  43. package/dist/{models-RVXHUSO6.js → models-PS4L7NLP.js} +5 -5
  44. package/dist/{page-images-V3NUHVIE.js → page-images-QW7IUTUB.js} +2 -2
  45. package/dist/{parse-worker-v2-N5GNR2M4.js → parse-worker-v2-PRH6KVKP.js} +23 -23
  46. package/dist/{parser-HJXLKIQJ.js → parser-OQIR5ZMI.js} +14 -14
  47. package/dist/{pdf-ocr-OCXKEJL7.js → pdf-ocr-ZH4JAUTR.js} +9 -9
  48. package/dist/{profile-io-DTAP26A4.js → profile-io-JFRAM2VE.js} +3 -3
  49. package/dist/{rasterize-UNT2CNKR.js → rasterize-JJOMUTYX.js} +3 -3
  50. package/dist/{redact-doc-D76ULHWT.js → redact-doc-A7TW4MNF.js} +22 -22
  51. package/dist/{render-D26TXZMX.js → render-VAOMAQV2.js} +10 -10
  52. package/dist/{rewrite-fallback-MP7LAJCW.js → rewrite-fallback-7PR7V3AZ.js} +12 -12
  53. package/dist/seal-RZZNRJFL.js +14 -0
  54. package/dist/{setup-3AEQJP6V.js → setup-6DXZJQCT.js} +3 -3
  55. package/dist/{to-hwpx-MNDLBCGC.js → to-hwpx-A56R6H27.js} +7 -7
  56. package/dist/visual-25RY7EFI.js +42 -0
  57. package/dist/{watch-2IVEGZ7U.js → watch-7W6CKGX7.js} +22 -22
  58. package/package.json +1 -1
  59. package/dist/chunk-SXCZLQWK.js.map +0 -7
  60. package/dist/chunk-W24M3GRV.js.map +0 -7
  61. package/dist/chunks-DDSN3VYT.js +0 -10
  62. package/dist/memo-JGUOC4ZP.js +0 -15
  63. package/dist/seal-OOIIF2IN.js +0 -14
  64. package/dist/visual-QQVRZNCA.js +0 -42
  65. /package/dist/{chunk-NJ4XKLJ2.js.map → chunk-24LB25LZ.js.map} +0 -0
  66. /package/dist/{chunk-2PG66APB.js.map → chunk-3AYNFK6J.js.map} +0 -0
  67. /package/dist/{chunk-3PP4Z3FP.js.map → chunk-5MDRUEHP.js.map} +0 -0
  68. /package/dist/{chunk-BADCOPJC.js.map → chunk-5ULHNZ3P.js.map} +0 -0
  69. /package/dist/{chunk-Y5SKJKIK.js.map → chunk-6I3X54AQ.js.map} +0 -0
  70. /package/dist/{chunk-XPCPNLPL.js.map → chunk-6MCJHRSM.js.map} +0 -0
  71. /package/dist/{chunk-3VFPOZUF.js.map → chunk-DZOA5N5W.js.map} +0 -0
  72. /package/dist/{chunk-C23CZCN2.js.map → chunk-FDSFXE2L.js.map} +0 -0
  73. /package/dist/{chunk-JOVWROSN.js.map → chunk-GJORKM42.js.map} +0 -0
  74. /package/dist/{chunk-53HOCVFW.js.map → chunk-HQILGS2O.js.map} +0 -0
  75. /package/dist/{chunk-YL5NXWPG.js.map → chunk-KW4JO5CV.js.map} +0 -0
  76. /package/dist/{chunk-YAJUYPG6.js.map → chunk-LSUTK3DH.js.map} +0 -0
  77. /package/dist/{chunk-74PQK4BH.js.map → chunk-MWCJYIJC.js.map} +0 -0
  78. /package/dist/{chunk-Q2IBOGTT.js.map → chunk-PFNZQ3XI.js.map} +0 -0
  79. /package/dist/{chunk-OJL2KWEP.js.map → chunk-PVOLFVXE.js.map} +0 -0
  80. /package/dist/{chunk-N4G253GI.js.map → chunk-QNJ2LMUO.js.map} +0 -0
  81. /package/dist/{chunk-4AHUE7MM.js.map → chunk-QOCUFTT4.js.map} +0 -0
  82. /package/dist/{chunk-FL3O63DT.js.map → chunk-S553BW45.js.map} +0 -0
  83. /package/dist/{chunk-2RRYYIDJ.js.map → chunk-TI6S3KZF.js.map} +0 -0
  84. /package/dist/{chunk-CCJ66IWE.js.map → chunk-W5AHXAUP.js.map} +0 -0
  85. /package/dist/{chunk-P74JR5PT.js.map → chunk-XUBBFY3H.js.map} +0 -0
  86. /package/dist/{chunk-YKPC2V2D.js.map → chunk-ZCMMU34Z.js.map} +0 -0
  87. /package/dist/{chunk-4JIM5KIE.js.map → chunk-ZO4P735U.js.map} +0 -0
  88. /package/dist/{chunks-DDSN3VYT.js.map → chunks-XX7RHVQF.js.map} +0 -0
  89. /package/dist/{formula-ZLRIPWXH.js.map → formula-HMKT4BZL.js.map} +0 -0
  90. /package/dist/{generator-TQUJJGL2.js.map → generator-HOY4SZ26.js.map} +0 -0
  91. /package/dist/{hancom-ET5G25Y3.js.map → hancom-QWJBWOOE.js.map} +0 -0
  92. /package/dist/{image-ocr-PINHNXEM.js.map → image-ocr-P5AIZNT3.js.map} +0 -0
  93. /package/dist/{memo-JGUOC4ZP.js.map → memo-Q7772VJD.js.map} +0 -0
  94. /package/dist/{model-bundle-PHN7MCDR.js.map → model-bundle-5CXCIZHZ.js.map} +0 -0
  95. /package/dist/{models-RVXHUSO6.js.map → models-PS4L7NLP.js.map} +0 -0
  96. /package/dist/{page-images-V3NUHVIE.js.map → page-images-QW7IUTUB.js.map} +0 -0
  97. /package/dist/{parse-worker-v2-N5GNR2M4.js.map → parse-worker-v2-PRH6KVKP.js.map} +0 -0
  98. /package/dist/{parser-HJXLKIQJ.js.map → parser-OQIR5ZMI.js.map} +0 -0
  99. /package/dist/{pdf-ocr-OCXKEJL7.js.map → pdf-ocr-ZH4JAUTR.js.map} +0 -0
  100. /package/dist/{profile-io-DTAP26A4.js.map → profile-io-JFRAM2VE.js.map} +0 -0
  101. /package/dist/{rasterize-UNT2CNKR.js.map → rasterize-JJOMUTYX.js.map} +0 -0
  102. /package/dist/{redact-doc-D76ULHWT.js.map → redact-doc-A7TW4MNF.js.map} +0 -0
  103. /package/dist/{render-D26TXZMX.js.map → render-VAOMAQV2.js.map} +0 -0
  104. /package/dist/{rewrite-fallback-MP7LAJCW.js.map → rewrite-fallback-7PR7V3AZ.js.map} +0 -0
  105. /package/dist/{seal-OOIIF2IN.js.map → seal-RZZNRJFL.js.map} +0 -0
  106. /package/dist/{setup-3AEQJP6V.js.map → setup-6DXZJQCT.js.map} +0 -0
  107. /package/dist/{to-hwpx-MNDLBCGC.js.map → to-hwpx-A56R6H27.js.map} +0 -0
  108. /package/dist/{visual-QQVRZNCA.js.map → visual-25RY7EFI.js.map} +0 -0
  109. /package/dist/{watch-2IVEGZ7U.js.map → watch-7W6CKGX7.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -381,7 +381,7 @@ var VERSION, KordocError, MAX_UNZIP_ENV_MB, SAFE_HREF_RE, HREF_ESCAPE, BARE_URL,
381
381
  var init_utils = __esm({
382
382
  "src/utils.ts"() {
383
383
  "use strict";
384
- VERSION = true ? "4.25.20" : "0.0.0-dev";
384
+ VERSION = true ? "4.25.21" : "0.0.0-dev";
385
385
  KordocError = class extends Error {
386
386
  constructor(message) {
387
387
  super(message);
@@ -28143,6 +28143,47 @@ function editedFromVisual(keepMarkdown, visualMarkdown, editedMarkdown) {
28143
28143
  }
28144
28144
  return v > k;
28145
28145
  }
28146
+ function removeNoteMarks(text, marks) {
28147
+ let out = text;
28148
+ let cursor = 0;
28149
+ const missing = [];
28150
+ for (const mark of marks) {
28151
+ if (!mark) continue;
28152
+ let at = -1;
28153
+ for (let p = out.indexOf(mark, cursor); p !== -1; p = out.indexOf(mark, p + 1)) {
28154
+ if (p === 0 || !/\s/.test(out[p - 1])) {
28155
+ at = p;
28156
+ break;
28157
+ }
28158
+ if (at === -1) at = p;
28159
+ }
28160
+ if (at === -1) {
28161
+ missing.push(mark);
28162
+ continue;
28163
+ }
28164
+ out = out.slice(0, at) + out.slice(at + mark.length);
28165
+ cursor = at;
28166
+ }
28167
+ return { text: out, missing };
28168
+ }
28169
+ function noteMarksOf(footnoteText) {
28170
+ return footnoteText ? footnoteText.split("; ").map((s) => s.match(/^(\S+)\s/)?.[1] ?? "").filter(Boolean) : [];
28171
+ }
28172
+ function splitCellNote(before2, after2, skipped) {
28173
+ const re = /\s*\(주: ([\s\S]*)\)$/;
28174
+ const bm = before2.match(re);
28175
+ if (!bm) return { before: before2, after: after2, noted: false };
28176
+ const marks = noteMarksOf(bm[1]);
28177
+ const am = after2.match(re);
28178
+ let body = after2;
28179
+ if (am) {
28180
+ body = after2.slice(0, am.index).trimEnd();
28181
+ if (normForMatch(am[1]) !== normForMatch(bm[1])) skipped.push({ reason: "각주 텍스트 수정은 미지원 — 본문만 적용", before: bm[1], after: am[1] });
28182
+ } else skipped.push({ reason: "각주 표기 삭제는 미지원 — 각주 유지, 본문만 적용", before: `(주: ${bm[1]})` });
28183
+ const r = removeNoteMarks(body, marks);
28184
+ if (r.missing.length) skipped.push({ reason: "각주 참조 부호 삭제는 미지원 — 각주 유지, 본문만 적용", before: r.missing.join(" ") });
28185
+ return { before: removeNoteMarks(before2.slice(0, bm.index).trimEnd(), marks).text, after: r.text, noted: true };
28186
+ }
28146
28187
  var AUTOLINK, AUTONUM_PREFIX_RE, LAYOUT_MODE_MISMATCH;
28147
28188
  var init_markdown_units = __esm({
28148
28189
  "src/roundtrip/markdown-units.ts"() {
@@ -31420,6 +31461,8 @@ function restoreSymbols(text, ringDecided = false) {
31420
31461
  if (/[가-힣]/.test(s)) s = s.replace(/(\d)l(?![A-Za-z])/g, "$1ℓ");
31421
31462
  s = s.replace(/([((])\s?[A-Za-z@&]\s?(?=(?:0\d{1,2}-)?\d{3,4}-\d{4}\b)/g, "$1☎");
31422
31463
  if (!s.includes("]")) s = s.replace(/^\[(?=[\u2460-\u2473])/, "");
31464
+ s = s.replace(/%\u3002/g, "‰");
31465
+ if (/[\uac00-\ud7a3]/.test(s)) s = s.replace(/(?<=[\uac00-\ud7a3\d)])\u3002/g, ".");
31423
31466
  return smartQuotes(dateDots(dateCommas(joinDigitGroups(s))));
31424
31467
  }
31425
31468
  function dateCommas(s) {
@@ -81778,9 +81821,16 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
81778
81821
  };
81779
81822
  const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
81780
81823
  if (!cell2) return skip("셀 좌표 매핑 실패 (병합 영역의 빈 칸이거나 좌표 불일치)");
81824
+ const origLines = gfmCellLines(before2);
81825
+ if (origLines.some((l) => /\(주: [\s\S]*\)$/.test(l)) && origLines.length === newLines.length) {
81826
+ const notes = newLines.map((l, i) => splitCellNote(origLines[i], l, ctx.skipped));
81827
+ newLines = notes.map((n) => n.after);
81828
+ before2 = notes.map((n) => n.before).join("<br>");
81829
+ }
81781
81830
  const irCell = table2.cells[gridR]?.[gridC];
81782
81831
  const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
81783
- if (irCell && normForMatch(scanJoined) !== normForMatch(noScriptTags(stripCellTokens(irCell.text)))) {
81832
+ const noteless = (text) => text.split("\n").map((l) => splitCellNote(l, l, []).before).join("\n");
81833
+ if (irCell && normForMatch(scanJoined) !== normForMatch(noteless(noScriptTags(stripCellTokens(irCell.text))))) {
81784
81834
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
81785
81835
  const flatBlocks = (irCell.blocks ?? []).filter((b) => b.type === "paragraph" || b.type === "heading");
81786
81836
  const flatJoined = noScriptTags(flatBlocks.map((b) => b.text ?? "").join("\n"));
@@ -83445,6 +83495,7 @@ function resolveParaMappings(blocks, scans) {
83445
83495
  const text = noScriptTags(b.text);
83446
83496
  let key3 = normForMatch(text);
83447
83497
  let prefixStripped = false;
83498
+ let noteMarks;
83448
83499
  if (!buckets.has(key3)) {
83449
83500
  const sp = text.indexOf(" ");
83450
83501
  if (sp > 0) {
@@ -83455,6 +83506,15 @@ function resolveParaMappings(blocks, scans) {
83455
83506
  }
83456
83507
  }
83457
83508
  }
83509
+ const marks = noteMarksOf(b.footnoteText);
83510
+ if (!buckets.has(key3) && marks.length) {
83511
+ const r = removeNoteMarks(text, marks);
83512
+ const alt2 = r.missing.length ? "" : normForMatch(r.text);
83513
+ if (alt2 && buckets.has(alt2)) {
83514
+ key3 = alt2;
83515
+ noteMarks = marks;
83516
+ }
83517
+ }
83458
83518
  const found = buckets.get(key3);
83459
83519
  const list = found ? pairable(key3, found) : null;
83460
83520
  if (!list) {
@@ -83463,7 +83523,7 @@ function resolveParaMappings(blocks, scans) {
83463
83523
  }
83464
83524
  const occ = counters.get(key3) ?? 0;
83465
83525
  counters.set(key3, occ + 1);
83466
- result.set(i, occ < list.length ? { para: list[occ], prefixStripped } : {});
83526
+ result.set(i, occ < list.length ? { para: list[occ], prefixStripped, noteMarks } : {});
83467
83527
  }
83468
83528
  return result;
83469
83529
  }
@@ -83620,29 +83680,38 @@ function patchParagraph(block, orig, edited, ctx, skip) {
83620
83680
  if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
83621
83681
  return skip("다중줄 문단 수정에 <br> 없음 — 줄바꿈 위치 보존 불가로 미지원 (줄바꿈은 <br>로 표기)");
83622
83682
  }
83683
+ let noteEdited = false;
83623
83684
  if (block.footnoteText) {
83624
83685
  const noteMatch = newPlain.match(/\s*\(주: ([\s\S]*)\)$/);
83625
83686
  if (noteMatch) {
83626
83687
  newPlain = newPlain.slice(0, noteMatch.index).trimEnd();
83627
83688
  if (normForMatch(noteMatch[1]) !== normForMatch(block.footnoteText)) {
83628
83689
  ctx.skipped.push({ reason: "각주 텍스트 수정은 미지원 — 본문만 적용", before: block.footnoteText, after: noteMatch[1] });
83690
+ noteEdited = true;
83629
83691
  }
83630
83692
  } else {
83631
83693
  ctx.skipped.push({ reason: "각주 표기 삭제는 미지원 — 각주 유지, 본문만 적용", before: `(주: ${block.footnoteText})` });
83632
83694
  }
83633
83695
  }
83696
+ if (mapping.noteMarks?.length) {
83697
+ const r = removeNoteMarks(newPlain, mapping.noteMarks);
83698
+ newPlain = r.text;
83699
+ if (r.missing.length) ctx.skipped.push({ reason: "각주 참조 부호 삭제는 미지원 — 각주 유지, 본문만 적용", before: r.missing.join(" ") });
83700
+ }
83634
83701
  if (mapping.prefixStripped) {
83635
83702
  const head = stripHeadMarker(block.text, newPlain);
83636
83703
  newPlain = head.text;
83637
83704
  if (head.note) ctx.skipped.push({ reason: head.note, after: summarize(newPlain), partial: true });
83638
83705
  }
83639
- const origPlain = block.text != null ? noScriptTags(block.text) : restoreBr(origStyled.plain);
83640
- if (newPlain === origPlain) return skip("텍스트 외 변경(헤딩 레벨/서식)만 감지 — 스타일 변경은 미지원");
83706
+ let origPlain = block.text != null ? noScriptTags(block.text) : restoreBr(origStyled.plain);
83707
+ if (mapping.noteMarks?.length) origPlain = removeNoteMarks(origPlain, mapping.noteMarks).text;
83708
+ if (newPlain === origPlain) return noteEdited ? 0 : skip("텍스트 외 변경(헤딩 레벨/서식)만 감지 — 스타일 변경은 미지원");
83641
83709
  if (sanitizeText(newPlain) !== newPlain && sanitizeText(origPlain) === origPlain) {
83642
83710
  return skip("공백 정규화 불안정 텍스트 — 패치 시 원문 보존 불가로 미지원");
83643
83711
  }
83644
83712
  let origMd = restoreBr(origStyled.plain);
83645
83713
  if (block.footnoteText) origMd = origMd.replace(/\s*\(주: [\s\S]*\)$/, "");
83714
+ if (mapping.noteMarks?.length) origMd = removeNoteMarks(origMd, mapping.noteMarks).text;
83646
83715
  if (mapping.prefixStripped) origMd = stripShownHeadMarker(block.text, origMd);
83647
83716
  const off = editedStyled.plain.length - newPlain.length;
83648
83717
  const style2 = ctx.charBook && off >= 0 && editedStyled.plain.endsWith(newPlain) && origStyled.plain.endsWith(origMd) ? { flags: flagsPerChar(editedStyled.segs, editedStyled.flags).slice(off), known: origStyled.flags.reduce((a, b) => a | b, 0), book: ctx.charBook } : void 0;
@@ -83680,8 +83749,8 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
83680
83749
  cellSkip("서식/링크/이미지 포함 셀 수정은 미지원 (v1)");
83681
83750
  continue;
83682
83751
  }
83683
- const before2 = beforeEach.join("\n");
83684
- const after2 = afterEach.join("\n");
83752
+ if (beforeEach.join("\n") === afterEach.join("\n")) continue;
83753
+ const { before: before2, after: after2, noted } = splitCellNote(beforeEach.join("\n"), afterEach.join("\n"), ctx.skipped);
83685
83754
  if (before2 === after2) continue;
83686
83755
  const para2 = cell2.paras[0];
83687
83756
  if (normForMatch(para2.rawText) !== normForMatch(before2)) {
@@ -83700,7 +83769,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
83700
83769
  ctx.keepLineseg,
83701
83770
  before2,
83702
83771
  // 바뀐 자리만 — 굵은 조각 등 run 유지
83703
- cellLineStyles(origRows[r][c], editedRows[r][c], ctx.charBook)(0, after2)
83772
+ noted ? void 0 : cellLineStyles(origRows[r][c], editedRows[r][c], ctx.charBook)(0, after2)
83704
83773
  );
83705
83774
  continue;
83706
83775
  }
@@ -83709,12 +83778,14 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
83709
83778
  continue;
83710
83779
  }
83711
83780
  for (let k = 0; k < cell2.paras.length; k++) {
83712
- const before2 = gfmCellToPlain(beforeParts[k]);
83713
- const after2 = gfmCellToPlain(afterParts[k]);
83714
- if (before2 === null || after2 === null) {
83781
+ const rawBefore = gfmCellToPlain(beforeParts[k]);
83782
+ const rawAfter = gfmCellToPlain(afterParts[k]);
83783
+ if (rawBefore === null || rawAfter === null) {
83715
83784
  cellSkip("서식/링크/이미지 포함 셀 수정은 미지원 (v1)");
83716
83785
  break;
83717
83786
  }
83787
+ if (rawBefore === rawAfter) continue;
83788
+ const { before: before2, after: after2, noted } = splitCellNote(rawBefore, rawAfter, ctx.skipped);
83718
83789
  if (before2 === after2) continue;
83719
83790
  if (after2.includes("\n")) {
83720
83791
  cellSkip("셀 내 줄바꿈 추가는 미지원 (v1)");
@@ -83737,7 +83808,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
83737
83808
  ctx.keepLineseg,
83738
83809
  before2,
83739
83810
  // 바뀐 자리만 — 굵은 조각 등 run 유지
83740
- cellLineStyles(origRows[r][c], editedRows[r][c], ctx.charBook)(k, after2)
83811
+ noted ? void 0 : cellLineStyles(origRows[r][c], editedRows[r][c], ctx.charBook)(k, after2)
83741
83812
  );
83742
83813
  }
83743
83814
  }
@@ -84379,29 +84450,6 @@ function textWithoutMarks(irKey, scanKey, marks) {
84379
84450
  }
84380
84451
  return j === scanKey.length && k === marks.length;
84381
84452
  }
84382
- function removeNoteMarks(text, marks) {
84383
- let out = text;
84384
- let cursor = 0;
84385
- const missing = [];
84386
- for (const mark of marks) {
84387
- if (!mark) continue;
84388
- let at = -1;
84389
- for (let p = out.indexOf(mark, cursor); p !== -1; p = out.indexOf(mark, p + 1)) {
84390
- if (p === 0 || !/\s/.test(out[p - 1])) {
84391
- at = p;
84392
- break;
84393
- }
84394
- if (at === -1) at = p;
84395
- }
84396
- if (at === -1) {
84397
- missing.push(mark);
84398
- continue;
84399
- }
84400
- out = out.slice(0, at) + out.slice(at + mark.length);
84401
- cursor = at;
84402
- }
84403
- return { text: out, missing };
84404
- }
84405
84453
  function fallbackPlain(raw, block) {
84406
84454
  const inline = block ? textUnitInline(raw, block, "\n") : raw.split("\n").map((l) => l.trim()).filter(Boolean).join("\n");
84407
84455
  return parseEmphasis(inline.replace(/!\[[^\]]*\]\([^)]*\)/g, " ").replace(/<br\s*\/?>/gi, "\n")).plain.replace(/<\/?(?:sup|sub)>/g, "");
@@ -84545,6 +84593,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
84545
84593
  let origPlain = origInline.plain;
84546
84594
  let newPlain = newInline.plain;
84547
84595
  const segsUsable = !block.footnoteText && !mapping.noteMarks?.length && !mapping.prefixStripped;
84596
+ let noteEdited = false;
84548
84597
  if (block.footnoteText) {
84549
84598
  const origNote = block.footnoteBlocks ? origPlain.match(/\s*\(주: ([\s\S]*)\)$/)?.[1] : void 0;
84550
84599
  origPlain = origPlain.replace(/\s*\(주: [\s\S]*\)$/, "");
@@ -84553,6 +84602,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
84553
84602
  newPlain = newPlain.slice(0, noteMatch.index).trimEnd();
84554
84603
  if (normForMatch(noteMatch[1]) !== normForMatch(origNote ?? block.footnoteText)) {
84555
84604
  ctx.skipped.push({ reason: "각주 텍스트 수정은 미지원 — 본문만 적용", before: block.footnoteText, after: noteMatch[1] });
84605
+ noteEdited = true;
84556
84606
  }
84557
84607
  } else {
84558
84608
  ctx.skipped.push({ reason: "각주 표기 삭제는 미지원 — 각주 유지, 본문만 적용", before: `(주: ${block.footnoteText})` });
@@ -84570,7 +84620,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
84570
84620
  newPlain = head.text;
84571
84621
  if (head.note) ctx.skipped.push({ reason: head.note, after: summarize(newPlain), partial: true });
84572
84622
  }
84573
- if (newPlain === origPlain) return skip("텍스트 외 변경(헤딩 레벨/서식)만 감지 — 스타일 변경은 미지원");
84623
+ if (newPlain === origPlain) return noteEdited ? 0 : skip("텍스트 외 변경(헤딩 레벨/서식)만 감지 — 스타일 변경은 미지원");
84574
84624
  if (sanitizeText(newPlain) !== newPlain && sanitizeText(origPlain) === origPlain) {
84575
84625
  return skip("공백 정규화 불안정 텍스트 — 패치 시 원문 보존 불가로 미지원");
84576
84626
  }