Collapse long code examples behind a "Show all N lines" toggle

#11
by cetiennec HF Staff - opened

Follow-up to #10.

Code examples now render through a new CodeExample component: numbered header ("Code N: title"), a link to the file on GitHub, and code longer than ~20 lines collapsed to a 15-line preview with a fade and a "Show all N lines" toggle (aria-expanded, keyboard accessible). Short examples stay fully shown. Print / PDF export (export:pdf uses print media) always shows the full code.

Verified with a local npm run build and in the browser: 13 of the 14 examples collapse, toggle expands/collapses, no console errors; no dead anchors or KaTeX errors on the page.

๐Ÿค– Generated with Claude Code

HaomingSong changed pull request status to merged

Sign up or log in to comment