Skip to content

chore: bump seemark to v2.0.0 - #30

Merged
jamliaoo merged 1 commit into
mainfrom
upgrade/see-mark-2.0.0
Aug 17, 2026
Merged

chore: bump seemark to v2.0.0#30
jamliaoo merged 1 commit into
mainfrom
upgrade/see-mark-2.0.0

Conversation

@jamliaoo

@jamliaoo jamliaoo commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

背景描述 (Why)

@coseeing/see-mark 2.0.0 已發佈(SeeMark#44),移除了 AsciiMath 支援。
本 PR 讓 Template 跟上,並清掉一個只為 AsciiMath 存在的 build 設定。

破壞性變更 (Breaking)

項目 變更後行為
反引號 `...` 一律渲染為標準 markdown code span,永不解析為數學
LaTeX / Nemeth 不受影響

實作方法 (How)

  • package.json@coseeing/see-mark ^1.11.0^2.0.0(Template 自身版本維持 1.3.1,同 chore: bump seemark to v1.10.2 #28 慣例)
  • scripts/pipeline.mjs:移除 esbuild 的 define: { global: 'globalThis' }

那個 shim 純粹是因為 mathjax-full 的 asciimath legacy 會參照 Node 的 global。2.0.0 之後
bundle 內已無任何 arguments.callee,剩下的 mathjax v3(tex→mml、mml→svg)既不需要非嚴格
context 也不需要 global

format: 'iife' 保留 —— index.html 是用 classic(非 module)script 載入 main.js,讓匯出
網站能在 file:// 下運作。原註解把理由寫成「asciimath 需要非嚴格模式」,一併更正。

測試驗證

  • npm run lintnpm run buildnpm run build-zip 全數通過
  • bundle grep asciimath / arguments.callee 皆為 0(升級前分別是 4 / 1)
  • bundle 由 2,142,178 → 2,036,000 bytes,減少約 104 KB
  • publish 可重現性:registry 上的三個 bundle 與本地從 main build 的產物 sha256 全部一致
  • 瀏覽器實跑:無 render error、console 全乾淨;預設 fixture 的 MathJax SVG + sr-only
    MathML、圖片、五種 alert、內部連結皆正常
  • 行為變更確認`sum_(i=1)^n i``a/b`<code>\(\frac{n!}{k!}\)
    SVG(mfrac 1);fenced block → <pre><code>
  • 移除 define shim 後單獨驗過:build 成功、bundle 內無裸 global 參照、頁面渲染不變

補充說明

安裝時會多出 25 個套件(vuereactreact-domprop-types 及其相依,約 22 MB)——
see-mark 2.0.0 把它們宣告為 peerDependencies 且全部標記 optional: true,但 npm 仍會安裝。
不影響產物:bundle 內 @vue/runtime / react-dom grep 皆為 0,zip 大小不變。

實測 npm ci --omit=peer 可省下那 22 MB,且 bundle sha256 完全相同、lockfile 不受影響;
但安裝時間各跑 9 次後中位數 7.02s vs 7.26s,沒有可測量的差異。因此不值得為此改動 CI,
未列入本 PR。

see-mark 2.0.0 removes AsciiMath support. Backtick spans now always render
as standard markdown code spans instead of being parsed as math; LaTeX and
Nemeth are unaffected.

Drop the esbuild `define: { global: 'globalThis' }` shim: it only existed
because mathjax-full's asciimath legacy code referenced the Node `global`.
The remaining mathjax v3 code (tex->mml, mml->svg) needs neither that nor a
non-strict context, and the bundle no longer contains any `arguments.callee`.

`format: 'iife'` stays -- index.html loads main.js as a classic (non-module)
script so the exported site keeps working over file://. The comments said
asciimath was the reason for it; corrected.

@wendyyuchensun wendyyuchensun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks

@jamliaoo
jamliaoo merged commit 13ca1e3 into main Aug 17, 2026
1 check passed
@jamliaoo
jamliaoo deleted the upgrade/see-mark-2.0.0 branch August 17, 2026 22:52
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.

2 participants