rust-playground icon indicating copy to clipboard operation
rust-playground copied to clipboard

Request: Support for table of content and next exercise button

Open mofosyne opened this issue 1 year ago • 2 comments

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.

mofosyne avatar Apr 10 '23 06:04 mofosyne