Skip to content

feat: 多 draft 快捷编译($2 文件名占位符 + Compile All Drafts)#5

Merged
SongshGeo merged 2 commits into
mainfrom
dev
Jun 6, 2026
Merged

feat: 多 draft 快捷编译($2 文件名占位符 + Compile All Drafts)#5
SongshGeo merged 2 commits into
mainfrom
dev

Conversation

@SongshGeo

Copy link
Copy Markdown

背景

同一 project 下的多个 draft 共享一个 workflow,而 write-to-note 的输出文件名(target)是 workflow 里的单一静态字符串。切换 draft 时 target 不变,导致每次编译不同 draft 都要手动改导出文件名;也没有一次性编译整个 project 全部 draft 的方式。

本 PR 提供两个互补能力,让用户在插件内自由快捷地编译所有相关 draft。

改动

A. 每个 draft 独立的文件名占位符

  • write-to-note 的 Output path 新增 $2 → 当前 draft 名(draftTitle,为空时回退到 index 文件名),并支持多次出现;$1(项目标题)保持不变。
  • target 改成一次 compiled/$2.md,四个 draft 即各自导出到不同文件,无需再逐个改名。
  • 更新选项描述,说明两个占位符。

B. "Compile All Drafts" 按钮

  • 仅在多 draft 项目显示(复用 selectedProjectHasMultipleDrafts)。
  • 顺序编译 project 内每个 draft,各自用自己的 workflow(calculateWorkflow 校验,跳过无效的并提示)。
  • 批量编译时通过新增的 suppressOpenAfter 抑制逐个打开面板,避免一次弹出多个 pane;单个 Compile 仍遵循各自的 open-after 设置。
  • 串联管线:CompileContext.suppressOpenAftercompile(..., options)compile context wrapper(同时改为 return promise 以便 await)。

测试数据

  • 新增 test-longform-vault/submission-project/:一个 project、四个 draft(正文四幕 / 补充材料两幕 / 审稿回复两幕 / cover letter 一幕),共享同一个 metadata.json,用于复杂投稿场景测试。

验证

  • svelte-check:0 errors;改动的 .ts 文件 eslint 通过;npm run build 成功。
  • test-longform-vault 手动验证:占位符切 draft 编译各自成文件;Compile All Drafts 一次生成全部且不弹面板。

🤖 Generated with Claude Code

SongshGeo and others added 2 commits June 2, 2026 13:43
Distinguish this maintained fork from upstream Longform so it installs
and updates independently via BRAT. Changes plugin id/name in both
manifests; keeps the `longform` frontmatter key and CSS classes intact
for drop-in compatibility with existing vaults.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Introduced an optional parameter `suppressOpenAfter` in the compile function to control whether the compiled result opens in a new pane, particularly useful during batch compilations.
- Updated related components and types to accommodate this new functionality, enhancing user experience during multi-draft compilations.
- Added new submission project files and structured metadata for a complete submission package example.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SongshGeo SongshGeo merged commit 20263b4 into main Jun 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant