[PR #1798] [MERGED] fix(book): wrap long URLs to stop horizontal page overflow #29090

Closed
opened 2026-06-20 13:00:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1798
Author: @farhan523
Created: 5/23/2026
Status: Merged
Merged: 5/27/2026
Merged by: @profvjreddi

Base: devHead: fix/book-long-url-horizontal-overflow


📝 Commits (1)

  • cd910e4 fix(book): wrap long URLs to stop horizontal page overflow

📊 Changes

3 files changed (+47 additions, -0 deletions)

View changed files

📝 book/quarto/assets/styles/_base-styles.scss (+19 -0)
📝 shared/styles/partials/_links.scss (+12 -0)
📝 shared/styles/partials/_toc.scss (+16 -0)

📄 Description

Summary

On reference-heavy chapters (e.g. vol1 training), long unbreakable tokens — paper hashes (https://proceedings.neurips.cc/paper/2012/hash/6aca97005c68f1206823815f66102863-Abstract.html), arXiv ids, DOI suffixes — inside body links, column-margin notes, footnotes, callouts, and right-side TOC entries inflated the line box past their column width. That cascaded into page-level horizontal scroll on narrower viewports.

Fix: add overflow-wrap: anywhere to the global a rule and the TOC container so unbreakable tokens wrap inside their column instead of forcing the page wider.

Where the change goes

  • book/quarto/assets/styles/_base-styles.scss — the volume builds (vol1 + vol2) use this file. It carries duplicated TOC/link rules and does not import the shared partials, so the fix has to be applied here directly.
  • shared/styles/partials/_links.scss and shared/styles/partials/_toc.scss — the corresponding shared partials, for ecosystem sites that do consume them (site, tinytorch, labs, kits, instructors, slides, mlsysim docs). Defensive parity so the same regression doesn't reappear in those builds later.

Why anywhere (not break-word)

Only overflow-wrap: anywhere shrinks an element's min-content size, so flex/grid ancestors can actually narrow the column. break-word would still let the long URL define the column's min-content, and the overflow would persist on small viewports. Paired with min-width: 0 on the TOC container so the column is allowed to take the smaller size. Regular prose still breaks at word boundaries first; mid-token splits only kick in when nothing else fits.

Test plan

  • Open the vol1 training chapter (/vol1/contents/vol1/training/training.html) on a narrow viewport (~375 px).
  • Confirm no horizontal page scroll where the long neurips paper URL appears.
  • Confirm long URLs in margin-notes, footnotes, callouts, and the right-side TOC wrap inside their column.
  • Regular short links and prose look unchanged.
  • Spot-check vol2 (uses the same _base-styles.scss).
  • Spot-check an ecosystem Quarto site that consumes the shared partials (e.g. site/) for any regression.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1798 **Author:** [@farhan523](https://github.com/farhan523) **Created:** 5/23/2026 **Status:** ✅ Merged **Merged:** 5/27/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/book-long-url-horizontal-overflow` --- ### 📝 Commits (1) - [`cd910e4`](https://github.com/harvard-edge/cs249r_book/commit/cd910e446fee9ebc3b8d2bb0389ab2a21aefdb7c) fix(book): wrap long URLs to stop horizontal page overflow ### 📊 Changes **3 files changed** (+47 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `book/quarto/assets/styles/_base-styles.scss` (+19 -0) 📝 `shared/styles/partials/_links.scss` (+12 -0) 📝 `shared/styles/partials/_toc.scss` (+16 -0) </details> ### 📄 Description ## Summary On reference-heavy chapters (e.g. **vol1 training**), long unbreakable tokens — paper hashes (`https://proceedings.neurips.cc/paper/2012/hash/6aca97005c68f1206823815f66102863-Abstract.html`), arXiv ids, DOI suffixes — inside body links, column-margin notes, footnotes, callouts, and right-side TOC entries inflated the line box past their column width. That cascaded into **page-level horizontal scroll** on narrower viewports. Fix: add `overflow-wrap: anywhere` to the global `a` rule and the TOC container so unbreakable tokens wrap inside their column instead of forcing the page wider. ### Where the change goes - **`book/quarto/assets/styles/_base-styles.scss`** — the volume builds (vol1 + vol2) use this file. It carries duplicated TOC/link rules and does **not** import the shared partials, so the fix has to be applied here directly. - **`shared/styles/partials/_links.scss`** and **`shared/styles/partials/_toc.scss`** — the corresponding shared partials, for ecosystem sites that do consume them (site, tinytorch, labs, kits, instructors, slides, mlsysim docs). Defensive parity so the same regression doesn't reappear in those builds later. ### Why `anywhere` (not `break-word`) Only `overflow-wrap: anywhere` shrinks an element's **min-content size**, so flex/grid ancestors can actually narrow the column. `break-word` would still let the long URL define the column's min-content, and the overflow would persist on small viewports. Paired with `min-width: 0` on the TOC container so the column is allowed to take the smaller size. Regular prose still breaks at word boundaries first; mid-token splits only kick in when nothing else fits. ## Test plan - [ ] Open the vol1 training chapter (`/vol1/contents/vol1/training/training.html`) on a narrow viewport (~375 px). - [ ] Confirm no horizontal page scroll where the long neurips paper URL appears. - [ ] Confirm long URLs in margin-notes, footnotes, callouts, and the right-side TOC wrap inside their column. - [ ] Regular short links and prose look unchanged. - [ ] Spot-check vol2 (uses the same `_base-styles.scss`). - [ ] Spot-check an ecosystem Quarto site that consumes the shared partials (e.g. `site/`) for any regression. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-20 13:00:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#29090