Skip to content

Add "A Quick Tour of Rust" preamble page#36

Merged
mre merged 1 commit into
mainfrom
feat/quick-tour-of-rust
Jun 21, 2026
Merged

Add "A Quick Tour of Rust" preamble page#36
mre merged 1 commit into
mainfrom
feat/quick-tour-of-rust

Conversation

@mre

@mre mre commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

Adds a read-only "A Quick Tour of Rust" preamble that shows most of the language on a single page, told as a tiny Super Mario program, before the slow per-concept chapters begin. The reader can just "soak it in," hover any keyword/type for a one-line explanation, and run/edit the code.

It sits right after the landing page and is the first entry in the table of contents.

Highlights

  • /tour page (templates/tour.html): one editable, runnable code box (reuses the playground's inline editor in run-only mode) with concept-class hover tooltips driven by a small dictionary + CodeMirror's hoverTooltip. Tooltips render into document.body so they aren't clipped by the editor's overflow: hidden.
  • Source in static/tour_starter.rs, embedded via include_str!, kept as a real .rs file so it stays editable and syntax-highlighted. Verified it compiles and runs at edition 2024.
  • Navigation: first TOC entry (number 0), surfaced from the dashboard intro and the post-warm-up signup flow, which now funnels into the tour. The tour is ULID-aware (/tour/{ulid}) so a freshly signed-up learner keeps their progress context into chapter 1.
  • Shared CTA: extracted the "Next chapter" button into partials/next_chapter_cta.html and moved its styles to base.html, so the tour and exercise pages share one component. The tour ends on that same button into chapter 1.
  • TOC fix: the two-column split now balances on the visible (non-bonus) row count via a chapter_rows() helper, so columns stay even as chapters are added/removed.
  • Inline editor: added a features.buildExtraExtensions hook so pages can layer extra CodeMirror extensions while reusing the shared module instances.

Testing

  • cargo check and cargo fmt --check pass.
  • rustc --edition 2024 on the tour source compiles and prints the expected World 1-1 playthrough.
  • Verified in a browser: hover tooltips work, the TOC columns are balanced (13/12), and the tour's next-chapter link resolves to /exercise/integers (anonymous) and /exercise/{ulid}/integers (with ULID).

Add a read-only preamble that shows most of Rust on a single page,
told as a tiny Super Mario program, before the slow per-concept
chapters begin.

- New /tour route + templates/tour.html: one editable, runnable code
  box (reuses the playground's inline editor in run-only mode) plus
  concept-class hover explanations driven by a small dictionary and
  CodeMirror's hoverTooltip. Tooltips render into document.body so they
  aren't clipped by the editor's overflow:hidden.
- Source lives in static/tour_starter.rs (embedded via include_str!),
  kept as a real .rs file so it stays editable and syntax-highlighted.
- The tour is the first table-of-contents entry (number 0) and is
  surfaced from the dashboard intro and the post-warm-up signup flow,
  which now funnels into /tour (ULID-aware via /tour/{ulid} so progress
  context carries into chapter 1).
- Extract the "Next chapter" CTA into partials/next_chapter_cta.html and
  move its styles to base.html so the tour and exercise pages share one
  component; the tour ends on that same button into chapter 1.
- Fix the TOC column split to balance on the visible (non-bonus) row
  count via a chapter_rows() helper, so the two columns stay even as
  chapters are added or removed.
- Add a features.buildExtraExtensions hook to the inline editor so pages
  can layer extra CodeMirror extensions while reusing the shared module
  instances.
@mre mre force-pushed the feat/quick-tour-of-rust branch from 5010ca8 to c94b062 Compare June 21, 2026 22:46
@mre mre merged commit e0654af into main Jun 21, 2026
4 checks passed
@mre mre deleted the feat/quick-tour-of-rust branch June 21, 2026 22:53
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