Add "A Quick Tour of Rust" preamble page#36
Merged
Merged
Conversation
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.
5010ca8 to
c94b062
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
/tourpage (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'shoverTooltip. Tooltips render intodocument.bodyso they aren't clipped by the editor'soverflow: hidden.static/tour_starter.rs, embedded viainclude_str!, kept as a real.rsfile so it stays editable and syntax-highlighted. Verified it compiles and runs at edition 2024.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.partials/next_chapter_cta.htmland moved its styles tobase.html, so the tour and exercise pages share one component. The tour ends on that same button into chapter 1.chapter_rows()helper, so columns stay even as chapters are added/removed.features.buildExtraExtensionshook so pages can layer extra CodeMirror extensions while reusing the shared module instances.Testing
cargo checkandcargo fmt --checkpass.rustc --edition 2024on the tour source compiles and prints the expected World 1-1 playthrough./exercise/integers(anonymous) and/exercise/{ulid}/integers(with ULID).