@wonseok-han/confluence-sync 2.0.2 → 2.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.
@@ -55,12 +55,12 @@ export function readDoc(baseDir, rel) {
55
55
  };
56
56
  }
57
57
  /** base 상대 경로 → 제목·앵커 인덱스(링크와 섹션 링크를 해석하는 데 둘 다 필요하다) */
58
- export function buildDocIndex(rels, baseDir) {
58
+ export function buildDocIndex(rels, baseDir, sourceDocs) {
59
59
  const titles = {};
60
60
  const anchors = {};
61
61
  const docs = {};
62
62
  for (const rel of rels) {
63
- const doc = readDoc(baseDir, rel);
63
+ const doc = sourceDocs?.[rel] ?? readDoc(baseDir, rel);
64
64
  titles[rel] = doc.title;
65
65
  anchors[rel] = doc.anchors;
66
66
  docs[rel] = doc;
@@ -107,8 +107,10 @@ export function resolveAnchorTargets(docs, vault, localTarget) {
107
107
  target = null;
108
108
  slug = decodeAnchor(la.fragment).toLowerCase();
109
109
  }
110
+ // Reference lookup may be ambiguous even when the vault resolved a nearby note.
111
+ // Keep that local target so preprocessing other notes cannot change anchor hashes.
110
112
  if (localTarget && la.dest)
111
- target = localTarget(rel, la.dest, la.wiki);
113
+ target = localTarget(rel, la.dest, la.wiki) ?? target;
112
114
  if (!target || !slug)
113
115
  continue;
114
116
  // 실제로 존재하는 헤딩만 — 없는 앵커는 markdown.ts 가 경고로 잡는다