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 — fix: KaTeX CSS の CDN URL を bundle 同梱版と動的同期 (#79) by ymnao · Pull Request #124 · ymnao/scripta

Conversation

@ymnao

@ymnao ymnao commented Jun 2, 2026

Copy link
Copy Markdown
Owner

概要

PDF / HTML export の HTML ヘッダの KaTeX CSS CDN URL が [email protected] でハードコードされており、bundle 同梱版(現状 0.17.0)と乖離していた問題を解消。katex/package.json の version を named import し URL を動的構築する。

関連 Issue

Closes #79

なお、issue 本文で「推奨」とされていた Option A(CSS / font 同梱によるオフライン化)は font の相対パス解決(pdf.ts の file: 制限と衝突)の追加設計が必要なため、本 PR のスコープから外し別 issue #121 として切り出した。

移行 Stage

該当なし(bug fix フェーズ [7] のため)。PDF export 機能は Stage 5 で実装済み、そこへの後方互換維持の修正。

  • Stage 0: 雛形 + フロント表示確認
  • Stage 1: ファイル I/O
  • Stage 2: ワークスペース・ファイルツリー・ファイル監視
  • Stage 3: 全文検索(ripgrep sidecar)
  • Stage 4: Git Sync
  • Stage 5: OGP / PDF / アップデート(既存機能のバグ修正)
  • Stage 6: 仕上げ・配布・切り替え

変更内容

  • src/lib/export.ts: import { version as katexVersion } from "katex/package.json" で named import し、KATEX_CSS_URL = \https://cdn.jsdelivr.net/npm/katex@${katexVersion}/dist/katex.min.css\`` をモジュールトップで 1 回構築。buildHtmlDocument の <link> で参照
  • src/lib/export.test.ts: 「CDN URL の version が katex/package.json と一致する」回帰テストを追加。test 側で katex/package.json を直接 import し、ハードコード時代(0.16.33 固定)に戻った場合 fail させる
  • /simplify cleanup を 2 つ目の commit に分離(named import で未使用 JSON フィールドが tree-shake され renderer bundle ~7KB 削減、冗長コメント / tautological な第2 assertion / test-only export を削除)

動作確認

  • pnpm format clean
  • pnpm lint clean
  • pnpm typecheck clean
  • pnpm typecheck:e2e clean
  • pnpm test(unit, 1798 pass, 2 skipped)
  • pnpm build 成功(bundle 2,986KB → 2,979KB、~7KB 縮小)
  • pnpm check:legacy-residue clean
  • 手動 QA: 数式を含む markdown を PDF export → KaTeX 数式が 0.17.0 の CSS で正常描画されること(マージ前に実機確認推奨)

スクリーンショット

該当なし(HTML 出力内の URL 文字列変更、UI 変更なし)。

Sorry, something went wrong.

Uh oh!

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

All reactions
ymnao and others added 2 commits June 2, 2026 14:08
@ymnao @claude
fix: KaTeX CSS の CDN URL を本体 katex のバージョンと動的同期 (#79)
5b66b23
`src/lib/export.ts:412` の "[email protected]" ハードコードを廃止し、
`katex/package.json` の version 文字列から URL を構築する。

- `KATEX_VERSION` を export し、CDN URL `https://cdn.jsdelivr.net/npm/katex@${KATEX_VERSION}/dist/katex.min.css` を組み立てる
- export.test.ts に「CDN URL の version が katex/package.json と一致」する回帰テストを追加(ハードコード時代の retrogression を防ぐ)
- 既存の `cdn.jsdelivr.net/npm/katex` を expect するテストはドメイン部のみマッチなのでそのまま通過

オフライン化(Option A: CSS / font を同梱)は本 issue のタイトル「古いバージョンで固定」の範囲外なので別 issue に分離する想定。

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@ymnao @claude
refactor: KaTeX バージョン同期コードを simplify (#79)
e022415
/simplify の cleanup レビュー指摘(reuse / simplification / efficiency / altitude)を反映。

- `import katexPkg from "katex/package.json"` → named import `{ version as katexVersion }` に変更。Rollup の JSON named export 経由で未使用フィールドが tree-shake され renderer bundle が ~7KB 縮小
- `KATEX_VERSION` の export 撤去(test seam だけだった smell を解消)。test 側で `katex/package.json` を直接 import して同期を assert
- 冗長な 3 行コメント → issue 参照 1 行に圧縮
- 冗長な `: string` 注釈を削除(TS が推論)
- test 側の tautological な第2 assertion (`KATEX_VERSION.toMatch(/^\d+\.\d+\.\d+/)`) を削除(katex/package.json を test していただけで自コードを test しない)
- test 内 redundant コメントを削除(test 名と重複)

挙動変更なし。bundle: 2,986KB → 2,979KB。

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings June 2, 2026 05:37
Copilot AI reviewed Jun 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sorry, something went wrong.

Uh oh!

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

All reactions
@ymnao
ymnao merged commit 5b38d32 into main Jun 2, 2026
7 checks passed

Uh oh!

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

@ymnao
ymnao deleted the fix/katex-css-version-sync branch June 2, 2026 05:45
ymnao added a commit that referenced this pull request Jun 5, 2026
@ymnao @claude
docs: CHANGELOG を v0.2.0 リリース内容に更新
0598509
- Fixed にバグ修正クラスタをロールアップ追記 (#116 #117 #120 #124 #130 #131 #132 #134 #135 #136 #137)
- Added に手動アップデートチェック (#98 → #138) を追記
- Dependencies を Phase α 反映の実バージョンに更新
  (electron 42.3.3 / biome 2.4.16 / zustand 5.0.14 / js-yaml 4.2.0 /
   dompurify 3.4.8 / marked 18.0.4 / lucide-react 1.17.0 /
   @codemirror/view 6.43.0 / vite 8.0.14 / vitest 4.1.7)
- リリース日を _(unreleased)_ に、旧リポ表記を scripta-tauri (private) に、
  footer URL を ymnao/scripta に修正

Co-Authored-By: Claude Opus 4.8 <[email protected]>
ymnao added a commit that referenced this pull request Jun 5, 2026
@ymnao @claude
release: v0.2.0 (Electron 版初回リリース) (#61)
be27030
* release: v0.2.0

- package.json:version 0.0.0 → 0.2.0
- CHANGELOG.md 新設(旧 Tauri 版から Electron への完全書き直し版として
  Added / Changed / Fixed / Dependencies / Security / 既知の制限 を記載)

closes #27

* docs: v0.2.0 リリース運用注釈と README の表現を release-ready に更新

レビュー指摘反映:
- README.md: "v0.2.0 を予定" / "リリース後 ... 取得できる予定" を
  リリース後にも valid な表現へ書き換え(merge → tag push 後に
  Releases ページが publish される前提)
- docs/parity-checklist.md § 12: 「必須 4 項目は tag push 前に
  手動検証で pass させ、検証ログを Release Notes に追記する」
  というリリース運用を冒頭に明示

* docs: CHANGELOG リリース日と parity-checklist リリース運用を実態に合わせる

レビュー指摘反映:
- CHANGELOG.md: リリース日を 2026-05-13 → 2026-05-14 (publish/tag 日に揃える)
- docs/parity-checklist.md § 12: release.yml が tag push 後に
  draft Release を `--generate-notes` で自動生成する流れに合わせ、
  「Release Notes 追記 → tag push」を「tag push → draft 自動生成
  → 生成された draft に検証ログ追記 → publish」の正しい順序へ修正

* docs: CHANGELOG を v0.2.0 リリース内容に更新

- Fixed にバグ修正クラスタをロールアップ追記 (#116 #117 #120 #124 #130 #131 #132 #134 #135 #136 #137)
- Added に手動アップデートチェック (#98 → #138) を追記
- Dependencies を Phase α 反映の実バージョンに更新
  (electron 42.3.3 / biome 2.4.16 / zustand 5.0.14 / js-yaml 4.2.0 /
   dompurify 3.4.8 / marked 18.0.4 / lucide-react 1.17.0 /
   @codemirror/view 6.43.0 / vite 8.0.14 / vitest 4.1.7)
- リリース日を _(unreleased)_ に、旧リポ表記を scripta-tauri (private) に、
  footer URL を ymnao/scripta に修正

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

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.

fix: PDF export の KaTeX CSS CDN URL が古いバージョンで固定 (export.ts:412)

Uh oh!

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

2 participants

@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.