GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: スライド PDF エクスポート機能を追加 by ymnao · Pull Request #329 · ymnao/scripta

Conversation

@ymnao

@ymnao ymnao commented Jul 13, 2026

Copy link
Copy Markdown
Owner

概要

Fable ロードマップ #4 の合流点として、スライド Markdown を 16:9 (1280×720) の 1 スライド 1 ページ PDF として書き出せるようにした (PR #316 で export した論理サイズ定数を初 consumer 化)。

関連 Issue

なし (Fable 推奨 #4、HANDOFF 78 A-1)

移行 Stage

  • Stage 5: OGP / PDF / アップデート

変更内容

  • ExportDialog に「スライド」セクションを追加。既存 PDF / HTML / プロンプトの隣に配置し、isPdfSupported (macOS/Windows) ガードを共有
  • 論理サイズ定数を src/types/slide.ts に集約し、SLIDE_LOGICAL_WIDTH/HEIGHT/PADDING_PX を SlidePreview と PDF export の共通 SSOT に (root font-size 依存を解消)
  • 新規 exportSlidesAsPdf (src/lib/export.ts): parseSlides で分割 → 各スライドを固定 1280×720 の <section> に配置し :not(:last-child) { break-after: page } で末尾空白ページ回避、mermaid は既存 rasterize 経路と同じ扱い、画像は resolveHtmlImageSrcs で scripta-asset:// 解決
  • pdf:export IPC に optional PdfExportOptions を追加 (pageSize μm / marginsInches / skipSectionBreakScript)。既存 PDF export の挙動は不変 (A4 preset + 20mm margin + section-break-script 実行)
  • セキュリティ強化: IPC 信頼境界で validatePdfExportOptions が pageSize (1000〜3,000,000μm)・margin (0〜5 inch)・skipSectionBreakScript (boolean) を検証、不正値は throw で拒否 (既存の assertWritePathAllowed パターンと揃えた defense in depth)
  • 単一改行 <br> 変換 (breaks オプション) は SlidePreview と揃えるためスライド経路では default (=false)。ExportDialog の「プレビュー通りの見た目」文言と WYSIWYG 契約を保持

動作確認

  • pnpm typecheck (web/node/e2e 3 種) clean
  • pnpm test 2365 passed / 2 skipped (105 files) — スライド export 5 件 + IPC validation 6 件を新規追加
  • pnpm lint (biome) clean
  • pnpm build (electron-vite) 成功 (399ms)
  • 実 Electron 起動での目視: pnpm dev → .md に --- で区切ったスライド → エクスポートダイアログ → 「スライド」→ 生成 PDF が 1280×720 1 スライド 1 ページになっていること (ローカル sandbox 不可、CI と手動確認で担保)
  • renderer-only e2e / 実 Electron e2e (sandbox listen EPERM でローカル不可、CI で確認)

スクリーンショット

なし (機能追加、UI は既存 ExportDialog の 4 番目セクション)

検証エビデンス

リスク分類

tier: medium — files_changed=12 / +406-37 (threshold の中規模、IPC 境界に変更を含む)

実行した検証

種別 コマンド 結果
Typecheck tsc -p tsconfig.web.json --noEmit / tsconfig.node.json / tsconfig.e2e.json 3 種 clean
Lint biome check (対象 file 群) 11 files clean
Unit test vitest run 2365 passed / 2 skipped (105 files)
Build electron-vite build 成功 (renderer + main + preload、399ms)
Security review codex-review security (2 run) 1 finding → apply → re-run で REFUTED (下記表参照)
renderer-only e2e pnpm test:e2e 未実施 (sandbox listen EPERM、CI で確認)
実 Electron e2e pnpm test:e2e:electron 未実施 (sandbox listen EPERM、CI で確認)

/simplify + /code-review medium の要約

  • /simplify (4 agents): apply 4 件 (S1 :not(:last-child) 統一 / S2 buildPrintOptions インライン化 / S3 冗長 @page margin:0 と @media print 削除 / A1 SLIDE_LOGICAL_PADDING_PX 追加)、Reuse / Efficiency 0 findings、defer 3 件 (A2/A3/A4)
  • /code-review medium (8 finder): apply 1 件 (F1 breaks:true を preview と揃える WYSIWYG fix)、skip 9 件 (F2 e2e mock 3 引数化 / R1 head shell 共有化 / R2 slide 前処理抽出 / Si1〜Si4 / A1 rename / A4 colors 分散)、Angle A/B/Efficiency/Conventions は 0 findings

レビュー指摘と対応

# 種別 指摘 対応
codex-security-1 MEDIUM (90%) renderer から渡される PdfExportOptions を IPC 境界で validate せず printToPDF に流している (extreme pageSize/margins で allocation 爆発の余地) 修正済み (c94d901) validatePdfExportOptions を追加、pageSize (1000〜3,000,000μm) / margin (0〜5 inch) / skipSectionBreakScript (boolean) を throw で validate、既存 assertWritePathAllowed パターンと揃えた defense in depth。負値・非数値・型崩れの negative-path テスト 4 件 + 正常系 2 件を追加
codex-security-2 (re-run) MEDIUM (92%) 同一指摘 (line 227 と誤指示、実際の validation は line 210 で printToPDF の前に配置済み) UNRESOLVED / REFUTED — apply 済みの validatePdfExportOptions(options) を codex が認識できていない偽陽性。tests (6 件全 pass) で validation の実動作を確認済み。codex-review skill 規約に従い max runs=2 で終了

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ymnao
feat: スライド PDF エクスポート機能を追加
c94d901
- ExportDialog に「スライド」セクションを追加し、Markdown を `---` 区切りで 16:9 (1280×720) の 1 スライド 1 ページ PDF として書き出せるようにした
- 論理サイズ定数 (SLIDE_LOGICAL_WIDTH/HEIGHT/PADDING_PX) を src/types/slide.ts に集約し、SlidePreview と PDF export で共通の WYSIWYG 前提として参照
- pdf:export IPC に optional な PdfExportOptions (pageSize / marginsInches / skipSectionBreakScript) を追加し、既存 PDF export の挙動は不変のまま preset A4 と slide 用カスタム pageSize を切り替え可能にした
- スライド用 HTML は :not(:last-child) で `break-after: page` を絞ることで末尾の空白ページを回避、印刷マージンは IPC 側 (marginsInches=0) で担保
- 既存 PDF export の section-break-script (#93) はスライド経路では不要なため skipSectionBreakScript で無効化
- 単一改行の `<br>` 変換 (breaks オプション) は SlidePreview と揃えるため slide 経路では default (=false) を使用し、ExportDialog の「プレビュー通りの見た目」文言と WYSIWYG 契約を維持
@ymnao
ymnao merged commit 5993ea0 into main Jul 14, 2026
9 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ymnao
ymnao deleted the feature/slide-pdf-export branch July 14, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@ymnao
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.