$ show ralfbiedert/cheats.rs
This repository powers https://cheats.rs/, a single-page interactive reference for the Rust programming language. Built with the Zola static site generator, it combines a massive Markdown content file (`content/_index.md`) with custom HTML, SCSS, and JavaScript to deliver a highly interactive cheat sheet. Core features include tabbed panels, memory-layout visualizations (using custom HTML tags like `<datum>` and `<memory-row>`), a day/night mode, an inline code playground, and an X-Ray feedback system that collects per-section sentiment via an external API. The build pipeline is orchestrated by a Gitea Actions workflow that runs Zola, post-processes with PostHTML (inlining assets), generates a PDF with Playwright, and deploys to S3 with Cloudflare cache purging. The codebase is well-structured for its domain, with clean separation of styling (SCSS), client-side logic (vanilla JS), and build scripts. It is actively maintained and demonstrates strong craftsmanship in creating a rich, offline-capable documentation experience, though its single-file content source is fragile and the heavy external dependency on api.cheats.rs poses a risk if the API goes down.
The LLM identified 3 files worth highlighting for reuse:
Implements a pure CSS tab panel system using hidden radio buttons and the `:checked` pseudo-class. No JavaScript required; works by styling sibling elements based on radio state. This pattern is self-contained, accessible (keyboard navigable), and can be extracted into any project needing lightweight tabbed content. Demonstrates non-obvious CSS skill.
Provides styles for custom HTML elements like `<datum>`, `<memory-row>`, and `<lifetime-section>` to create visual memory and lifetime diagrams. Uses CSS Grid and custom properties to render data layouts with colored blocks and annotations. This pattern is domain-specific to educational material but is cleanly abstracted and can be repurposed for any project needing diagrammatic explanations of data structures or memory.
A Node.js script that uses Playwright to render the cheat sheet webpage into a PDF. Configures page size (A4/Letter), margins, and emulates print media. Handles waiting for fonts and assets to load. This is a reusable pattern for any static site needing automated PDF generation, with minimal coupling to this specific project.