rust-lang / rust-lang/rust-playground

Request: Support for table of content and next exercise button

Open
#920 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
Rust
Stars
1.4k
Forks
267
Avg merge
3h 2m
Merged PRs (30d)
6

Description

Currently going though https://github.com/rust-lang/rustlings/tree/rustlings-1 and i found that it links to play.rust-lang.org via links like below:

https://play.rust-lang.org/?code=%2F%2F+variables1.rs%0A%2F%2F+Make+me+compile%21+Scroll+down+for+hints+%3A%29%0A%0Afn+main%28%29+%7B%0A++++x+%3D+5%3B%0A++++println%21%28%22x+has+the+value+%7B%7D%22%2C+x%29%3B%0A%7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%2F%2F+Hint%3A+The+declaration+on+line+5+is+missing+a+keyword+that+is+needed+in+Rust%0A%2F%2F+to+create+a+new+variable+binding.%0A

Where you allow for embedding code via code=.

Would it make sense to support an extra field like toc= and toc-curr-id= which may link to a json file that contains a list of each exercise and what part of the exercise we are currently at.

{
    "Title" : "Variable bindings",
    "Lesson Url":"https://github.com/rust-lang/rustlings/tree/rustlings-1#variable-bindings"
    "code":"https://play.rust-lang.org/?code=%2F%2F+variables1.rs%0A%2F%2F+Make+me+compile%21+Scroll+down+for+hints+%3A%29%0A%0Afn+main%28%29+%7B%0A++++x+%3D+5%3B%0A++++println%21%28%22x+has+the+value+%7B%7D%22%2C+x%29%3B%0A%7D%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%0A%2F%2F+Hint%3A+The+declaration+on+line+5+is+missing+a+keyword+that+is+needed+in+Rust%0A%2F%2F+to+create+a+new+variable+binding.%0A"
    "expected-output":"...expected code output..."
}

By knowing the exercise structure above, you also know whats the next exercise as well so could autogenerate a "next exercise" button as well.

It does get me thinking of there is already a standard for this, since this would be a pretty common use case for teaching multiple programming languages.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how play.rust-lang.org handles the existing code= query parameter and how its exercise page is structured. Evaluate the proposed toc= and toc-curr-id= parameters and the example JSON format, then define the navigation and data contract before implementation. Done means an agreed table of contents and working next-exercise navigation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.