@im-nobsidian/core 0.2.0 → 0.3.0

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.d.ts CHANGED
@@ -395,6 +395,13 @@ interface ProcessorMetadata {
395
395
  readonly properties?: Record<string, unknown>;
396
396
  readonly preserveMarkers?: PreserveMarker[];
397
397
  readonly images?: ImageReference[];
398
+ /**
399
+ * 원시 Notion markdown export 가 압축형(펜스 밖 빈 줄 0)이었는지 — orchestrator 가
400
+ * `notionEnhancedToObsidian` **이전**에 판정해 전달한다. enhanced 변환의
401
+ * `<empty-block/>`→빈 줄 치환이 끝난 뒤에는 BlockSpacer 가 스스로 판정할 수 없다(D1).
402
+ * true: 무조건 재간격 / false: 무동작 / 미지정: 내용 기반 휴리스틱 폴백.
403
+ */
404
+ readonly notionExportCompact?: boolean;
398
405
  readonly [key: string]: unknown;
399
406
  }
400
407
  interface ConversionContext {
@@ -1221,12 +1228,19 @@ declare class ImageHandler {
1221
1228
  constructor(vaultFs: VaultFS, attachmentFolder?: string, notionClient?: NotionClient | undefined, customFetch?: typeof globalThis.fetch, options?: MediaOptions, stateDb?: IStateDB | undefined);
1222
1229
  private get fetchFn();
1223
1230
  downloadImage(url: string, pageTitle: string): Promise<ImageDownloadResult>;
1224
- downloadAllImages(markdown: string, pageTitle: string): Promise<{
1231
+ private fetchImage;
1232
+ private persistImage;
1233
+ downloadAllImages(markdown: string, pageTitle: string, pageId?: string): Promise<{
1225
1234
  content: string;
1226
1235
  downloads: ImageDownloadResult[];
1227
1236
  }>;
1228
- uploadLocalImage(localPath: string): Promise<ImageUploadResult>;
1229
- uploadAndAppendImages(pageId: string, images: ImageReference[]): Promise<ImageUploadResult[]>;
1237
+ uploadLocalImage(localPath: string, noteFolder?: string): Promise<ImageUploadResult>;
1238
+ uploadAndAppendImages(pageId: string, images: ImageReference[], notePath?: string): Promise<ImageUploadResult[]>;
1239
+ /**
1240
+ * 임베드 경로를 볼트 실제 파일로 해석한다(F23). Obsidian 위키링크 임베드는 노트 옆
1241
+ * 파일을 파일명만으로 참조하는 게 관례라, 노트 폴더 → 볼트 루트 → attachments/ 순으로
1242
+ * 시도한다. 폴백은 조용히 진행하고, 전부 실패했을 때만 마지막 오류를 던진다.
1243
+ */
1230
1244
  private readImageFromVault;
1231
1245
  private getContentTypeFromPath;
1232
1246
  downloadAllFiles(markdown: string, pageTitle: string): Promise<{
@@ -1532,11 +1546,32 @@ declare class FrontmatterGenerator implements Processor {
1532
1546
  process(input: ProcessorInput): ProcessorOutput;
1533
1547
  }
1534
1548
 
1549
+ /**
1550
+ * 다른 복원기가 소비하지 못하고 실제로 유실된 보존 마커를 재삽입하는 최후 보루.
1551
+ *
1552
+ * 핵심 전제(F28 교훈): DB 에 저장된 startIndex 는 **push 시점 문자열**의 절대
1553
+ * 오프셋이라 pull 산출물에서는 무의미하다 — 프론트매터 앞·단어 한가운데에
1554
+ * 마커를 박아 파일을 파손시켰다. 재삽입은 반드시
1555
+ * 1) 이미 의미적으로 복원된 마커는 건너뛰고(위키링크 → `[[...]]` 존재 등),
1556
+ * 2) 텍스트 앵커(__anchor)를 1차 위치 수단으로 쓰며,
1557
+ * 3) 프론트매터 뒤·줄 경계에만, 마커 단독 줄로 삽입한다.
1558
+ *
1559
+ * 이중 모드: `__anchor` 키가 없는 마커는 구버전 DB blob(수집기가 앵커를 안 남기던
1560
+ * 시절)이다. 이들은 구계약 — "변환이 마커만 제거했다면 startIndex 오프셋 원문 삽입이
1561
+ * 원본을 정확히 재구성한다" — 을 유지하되 프론트매터 앞 삽입만 금지한다. 위해한
1562
+ * 레거시 사례(빈 params 껍데기, 이미 복원된 위키링크)는 render-null 폐기와 의미
1563
+ * 복원 검사가 이미 걸러낸다.
1564
+ */
1535
1565
  declare class PreserveMarkerInjector implements Processor {
1536
1566
  readonly name = "PreserveMarkerInjector";
1537
1567
  readonly order = 100;
1538
1568
  process(input: ProcessorInput): ProcessorOutput;
1539
- private formatMarker;
1569
+ /** 마커의 본문 표현. 복원 불가능한(빈) 마커는 null — 삽입하지 않고 폐기한다. */
1570
+ private renderMarker;
1571
+ /** 마커가 이미 원래 문법으로 복원돼 있으면 재삽입은 중복·오염이다. */
1572
+ private isSemanticallyRestored;
1573
+ /** 삽입 위치: 앵커 → startIndex(줄 경계 보정) 순. 항상 프론트매터 뒤. */
1574
+ private findInsertionPoint;
1540
1575
  }
1541
1576
 
1542
1577
  declare class LocalImageRestorer implements Processor {
@@ -1756,9 +1791,10 @@ type BasesViewType = "table" | "cards" | "list";
1756
1791
  * Notion 뷰 타입 → Obsidian Bases 뷰 타입 매핑(SSOT).
1757
1792
  *
1758
1793
  * `null` = Bases 에 대응 뷰가 없어 `.base` 로 표현 불가. 이 경우 해당 뷰는 `.base` 에서
1759
- * 누락되므로, 사이드카(`<db>.notion.json`)가 원본 뷰 설정을 무손실 보존한다
1760
- * (Notion API 는 뷰 생성/수정을 지원하지 않아 뷰는 pull-authoritative — push 로 되돌릴 수
1761
- * 없으므로 "조용한 유실 금지"는 곧 "보존 + 정직한 degrade 리포트"를 의미한다).
1794
+ * 누락되므로, 사이드카(`<db>.notion.json`)가 원본 뷰 설정을 무손실 보존한다.
1795
+ * 뷰는 현재 pull-authoritative — Notion API 가 2026-03-19 뷰 생성/수정/삭제를 열었지만
1796
+ * 본 프로젝트는 아직 뷰 write-back 을 구현하지 않았다(로드맵 항목). push 로 되돌릴 수
1797
+ * 없는 동안 "조용한 유실 금지"는 곧 "보존 + 정직한 degrade 리포트"를 의미한다.
1762
1798
  */
1763
1799
  declare const NOTION_TO_BASES_VIEW: Record<string, BasesViewType | null>;
1764
1800
  /** Notion 뷰 타입의 Bases 대응 타입을 돌려준다. 미지원/미상 타입은 `null`. */