Skip to content

Restyle library selector as pills; fix R highlighting and mobile overflow - #38

Merged
tdhopper merged 7 commits into
masterfrom
tab-pills
Aug 5, 2026
Merged

Restyle library selector as pills; fix R highlighting and mobile overflow#38
tdhopper merged 7 commits into
masterfrom
tab-pills

Conversation

@tdhopper

@tdhopper tdhopper commented Aug 5, 2026

Copy link
Copy Markdown
Owner

TL;DR

Ten libraries made the per-card nav-tabs row wrap into two ragged lines that read as broken layout. The selector is now a compact pill row: one line at 1200px+, tidy wrap below, active pill in the code panel's #202020 so the control visually binds to its output. Two latent template bugs fixed in passing: R code has never been syntax-highlighted (the lexer branch compared display name against slug and never fired), and Bootstrap 3's col-xs-12 (a no-op in Bootstrap 4) let code panels overflow ~50px on phones.

Stacked on #29 (perf-ux).

Files to review (3):

File Why
web/css/custom.css (start here) .library-pills block: chip sizing, white-on-gray inactive chips, dark active chip. Scoped by class so it can't leak into the navbar.
templates/t_index.html nav-tabsnav-pills library-pills; slug comparison for the R highlight branch; col-xs-12col-12.
render.py One casing fix: hvplot (Bokeh)hvPlot (Bokeh).

Reviewer notes

  • Tab toggling verified by scripted click (Bootstrap 4's tab plugin drives pills identically): one active pill, one active pane after switching.
  • R highlighting verified in output: R cells' FALSE now gets keyword classing from the R lexer.
  • Screenshots at 1400/1000/420px confirmed one-line, tidy-wrap, and mobile chip layouts; the 420px shot also confirms the col-12 overflow fix.

Plots are exported at ~1500x1500, and the page now ships 100+ of them.
Re-encoding the notebook's PNG output as quality-85 WebP cuts the image
payload from 8.5 MB to 2.6 MB with no visible loss. Filenames keep the
MD5-of-base64 scheme so unchanged plots keep their URLs.

image_from_cell now also returns the pixel dimensions, which the template
uses to reserve layout space.
Every plot image but the first one now loads lazily and decodes off the
main thread, so a visit only fetches what the reader scrolls to. The
width/height attributes come from the rendered image, which keeps the
cards from collapsing and reflowing as images arrive. Also adds alt text,
which the images never had.
The whole point of the site is lifting a snippet into your own notebook,
which until now meant selecting the pygments markup by hand. One
delegated click handler covers all 101 panels and falls back to a
"Press ⌘C" hint where the clipboard API is unavailable.

Also drops the $.bigfoot() call: the library was never loaded, so it threw
on every page load.
The heading already carried a deep link, but it was a Font Awesome icon
and Font Awesome is not loaded, so it rendered as nothing. A muted # after
the title is visible without competing with the heading.
og:image pointed at a cover.png over plain http, so previews were
insecure-mixed-content at best. It now points at the banner over https,
with the large-image Twitter card, matching twitter:* tags, a canonical
URL, and a description that names the libraries the page actually covers.
Ten file-folder tabs wrapped to two ragged lines and broke the metaphor.
Chips wrap cleanly instead: all libraries fit one line at 1200px and up,
and stack tidily below that.

Also fixes the hvPlot label casing.
The R highlight branch compared the display name against the slug, so
it never fired and R code was highlighted as Python. col-xs-12 is a
no-op in Bootstrap 4, letting code panels overflow on phones; col-12
is the correct class.
@tdhopper
tdhopper changed the base branch from perf-ux to master August 5, 2026 15:15
@tdhopper
tdhopper marked this pull request as ready for review August 5, 2026 15:15
@tdhopper
tdhopper merged commit d950ac5 into master Aug 5, 2026
1 check passed
@tdhopper
tdhopper deleted the tab-pills branch August 5, 2026 15:15
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.

1 participant