Shrink generated sites by about 28% #3

Merged
moof merged 0 commits from refs/pull/3/head into main 2026-10-21 00:19:08 +00:00
moof commented 2026-10-21 00:11:58 +00:00 (Migrated from code.moof.space)

Requested by Moof · project thread

On NeTEx_publication.xsd the site goes from 158 MB to 114 MB, and NetEx-docs builds six variants.

before after
src/ (source pages) 64 MB 26 MB
elements/ 40 MB 36 MB
types/ 54 MB 50 MB

Source pages. Pygments' HtmlFormatter gave every line an <a id name> anchor, a link and a linenos span (~130 bytes per line), and it also wrapped whitespace in spans and escaped every " as &#34;. Now the XML tokens are rendered directly, with one <span id="L-n"> per line. Line numbers come from a CSS counter, and site.js turns a click in the gutter into a #L-n link. The line ids are unchanged, so every existing link still works, and the line numbers no longer get copied along with selected code.

Source-path links. About 100k links repeated their full path in a title. site.js now builds that tooltip from the href on hover. Without JavaScript, the full path is still in the link target.

Also bumps the version to 0.7.1 so the publish step doesn't hit a duplicate again.

Tested: all 39 tests pass (with updated source-page assertions). I also checked a generated NeTEx source page in Chromium: line numbers render, #L-120 highlights its line, a gutter click sets the hash, and hovering a source link shows the full path.

What's left after this is mostly structural: the sidebar shell repeated on every page (about 12 MB), and the six variants each shipping their own copy of the same source pages. Sharing those would need a layout change in NetEx-docs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bwekd9qi3u7oYcMtUGthAK

<!-- claude-projects-attribution --> _Requested by **Moof** · [project thread](https://claude.ai/code/project/chan_01BmPQxcG1UuS21Gfai9Zcdh?thread=cmsg_01BmPQxcG1UuS21Gfai9Zcdh9K5YNRLuLz6yZT4aVDVjYr)_ On `NeTEx_publication.xsd` the site goes from **158 MB to 114 MB**, and NetEx-docs builds six variants. | | before | after | |---|---|---| | `src/` (source pages) | 64 MB | 26 MB | | `elements/` | 40 MB | 36 MB | | `types/` | 54 MB | 50 MB | **Source pages.** Pygments' `HtmlFormatter` gave every line an `<a id name>` anchor, a link and a `linenos` span (~130 bytes per line), and it also wrapped whitespace in spans and escaped every `"` as `&#34;`. Now the XML tokens are rendered directly, with one `<span id="L-n">` per line. Line numbers come from a CSS counter, and `site.js` turns a click in the gutter into a `#L-n` link. The line ids are unchanged, so every existing link still works, and the line numbers no longer get copied along with selected code. **Source-path links.** About 100k links repeated their full path in a `title`. `site.js` now builds that tooltip from the `href` on hover. Without JavaScript, the full path is still in the link target. Also bumps the version to 0.7.1 so the publish step doesn't hit a duplicate again. Tested: all 39 tests pass (with updated source-page assertions). I also checked a generated NeTEx source page in Chromium: line numbers render, `#L-120` highlights its line, a gutter click sets the hash, and hovering a source link shows the full path. What's left after this is mostly structural: the sidebar shell repeated on every page (about 12 MB), and the six variants each shipping their own copy of the same source pages. Sharing those would need a layout change in NetEx-docs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Bwekd9qi3u7oYcMtUGthAK
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Reference4PT/prettyxsd!3
No description provided.