rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

Hints to add offline documentation suggestions

Open Wilker-uwu opened this issue 2 years ago • 6 comments

hi! thank you for making this a thing, i appreciate it <3

i just wanted to ask if it would be good to make available commands and text to make the hints and similar text to be completely accessible offline, possibly all with cargo doc [...] --open too. it would help me a lot since i will be without an internet connection very soon.

thank you for the attention ^^

Wilker-uwu avatar Apr 28 '23 17:04 Wilker-uwu

After you've completed the installation, everything should be available offline. rustlings hint <exercise> will work regardless of whether you have an internet connection or not.

If you're asking about other materials, for example the book, that can be accessed offline by running rustup doc.

manyinsects avatar Apr 30 '23 09:04 manyinsects

that i do know, but the problem is that there are several hints linking to online resources instead, rather than offering commands or link for offline ones. see for example errors2: ALT: screenshot of a terminal log, showing the output of the command rustlings hint errors2, with a highlighted text to a link for a page in The Rust Programming Language.

it would be better if it instead¹ pointed to an equivalent page in the book linked by rustup doc (¹ or *additionally to, since there's also the chance where one could be running Rustlings in a place where files like these aren't as easily accessible.)

Wilker-uwu avatar Apr 30 '23 15:04 Wilker-uwu

Thank for you good idea, how implements your suggestions? @Wilker-uwu

This is my rust offline book file url. file:///Users/${username}/.rustup/toolchains/stable-x86_64-apple-darwin/share/doc/rust/html/book/ch03-02-data-types.html#data-types

1.get your username and your rust version. 2.dynamic replacement info.toml all online url about "hint" field, get offline read features. 3.check boundary items list

  1. some user not install offline book.
  2. CodeSpace user and Gitpod user feel
  3. user version is older, not found new features file
  4. user browser not support file protocol.
  5. ...

I thinking this a trouble. maybe you can deploy port 443 https://github.com/rust-lang/book, then edit hosts file replace your own deploy offline book IP, after open online rust book equals open offline.

Finally, simple way is replacing your info.toml hint field, but this project not only has one online url (https://doc.rust-lang.org/std https://doc.rust-lang.org/nomicon ...).

that i do know, but the problem is that there are several hints linking to online resources instead, rather than offering commands or link for offline ones. see for example errors2: ALT: screenshot of a terminal log, showing the output of the command rustlings hint errors2, with a highlighted text to a link for a page in The Rust Programming Language.

it would be better if it instead¹ pointed to an equivalent page in the book linked by rustup doc (¹ or *additionally to, since there's also the chance where one could be running Rustlings in a place where files like these aren't as easily accessible.)

XiaoZiShan avatar May 01 '23 17:05 XiaoZiShan

Yeah, trying to somehow dynamically replace those points in the hints is a misendeavour, I think, given the different kinds of environments people use Rustlings in. I see two possible ways to improve the situation here:

  • Replace or amend the book links with "See the Book, Chapter X, etc etc" so that it's easier for offline users to cross-reference the book
  • Add a paragraph somewhere (intro exercises? readme?) hinting at the existence of rustup doc, since not a lot of people know about it, and even if you're not offline, it may be more comfortable to use because of the significantly faster page load speed

manyinsects avatar May 02 '23 11:05 manyinsects

what if there was instead a way to implement in Rustup itself a way to open a given indexed section of the book or doc? maybe it would be easier to approach this issue if it was implemented on Rustup's side?

Wilker-uwu avatar May 03 '23 00:05 Wilker-uwu

Definitely! Feel free to open an issue on Rustup's side for that, if that does get implemented I'd be happy to add support for it here.

manyinsects avatar May 03 '23 08:05 manyinsects

I will close this issue because there is nothing Rustlings can do right now. It would be nice if rustup could take a link and open its offline equivalent. If this gets implemented, feel free to open an issue to add a hint in the introduction message :)

mo8it avatar Jul 07 '24 21:07 mo8it