Repository navigation
perf: deduplicate zh site_libs and images trees against root copies - #331
Merged
Merged
Conversation
babelquarto copies the shared site_libs/ and images/ trees into the rendered zh/ tree as byte-identical duplicates of the root copies, adding ~94 MB (51.6 + 42.7 MB) to every deployed site - 34% of the artifact after the iVolcano fix. Changes (issue #306 A3.2): - Add .github/scripts/rewrite-zh-site-refs.py: resolution-based rewriter. Every zh HTML reference that resolves under zh/site_libs/ or zh/images/ is rewritten to the root-tree equivalent relative to the page; references whose root target does not exist are left untouched and reported (measured on the live artifact: 5,215 refs across 267 pages, 0 unresolved). - Add .github/scripts/prune-zh-duplicates.py: deletes the zh/site_libs and zh/images trees, but refuses (nonzero exit) if any zh HTML still resolves a reference inside them - so a missed rewrite fails the build loudly instead of shipping broken pages. - Wire both scripts into quarto-publish.yml and quarto-publish-update-cache.yml after the zh figure-refs step. - Fix 5 zh chunk labels that drifted from their English counterparts (the cause of the only 5 broken zh figure refs in the current site): ManhattanPlot.zh.qmd fig-2.3Hlight -> fig-2.3Highlight; CellChatCirclePlot.zh.qmd fig1-overall-circle -> fig-1-overall-circle and three siblings, converted to the #| option style used elsewhere. Verified on a copy of the deployed artifact: rewrite + prune leaves 0 broken zh references (5,215/5,215 resolve to existing root-tree files), root site_libs/ and images/ bytes unchanged, and the prune guard aborts when a stale reference is injected. Co-Authored-By: Claude Code <noreply@anthropic.com>
Contributor
✅ QMD Format CheckNo new QMD tutorial files to check.
|
Contributor
📊 Quarto Render PreviewThe new or modified Quarto files have been rendered and are available as artifacts. 🔗 View and Download Rendered Files Click the link above, scroll to the "Artifacts" section at the bottom of the page, and download Modified files: |
This was referenced Oct 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Resolves the A3.2 (zh 站点资源去重) item of #306: babelquarto copies the shared
site_libs/andimages/trees into the renderedzh/tree as byte-identical duplicates of the root copies, adding ~94 MB to every deploy (measured on the live artifact from PR #330:zh/site_libs51.6 MB +zh/images42.7 MB,diff -rq→ 0 differences).Changes
New post-render pipeline step (both publish workflows)
.github/scripts/rewrite-zh-site-refs.py— resolution-based rewriter: for every zh HTML reference tosite_libs/…orimages/…, resolves it against the page directory; if the target lands insidezh/and the root-tree equivalent exists, rewrites it to the root tree's relative path. Non-HTML files are untouched (verified: the only candidate, a deadleaflet.cssinsidezh/site_libs, is never linked by any page). References whose root counterpart is missing are left as-is and reported..github/scripts/prune-zh-duplicates.py— deleteszh/site_libs+zh/images, but aborts with a nonzero exit if any zh HTML still resolves a reference inside them. A missed rewrite fails the build loudly instead of shipping broken pages.quarto-publish.ymlandquarto-publish-update-cache.ymlafter the zh figure-refs rewrite, before lazy-loading and freeze-cache save.Chunk-label drift fix (root cause of the only 5 broken zh figure refs)
Omics/ManhattanPlot.zh.qmd:fig-2.3Hlight→fig-2.3Highlight(matches English)Omics/CellChatCirclePlot.zh.qmd:fig1-overall-circle/fig2-individual-circle/fig3-chord/fig4-heatmap→fig-1-overall-circle/fig-2-individual-circle/fig-3-chord/fig-4-heatmap, converted to the#|option style used repo-wide; dimensions preserved. No@fig-cross-references exist in these files (rename-safe).Measured impact (on a copy of the live artifact)
Validation
site_libs/andimages/bytes unchanged (hash-verified)py_compile🤖 Generated with Claude Code