From f387f4c1d9d5a2b7b78d454e16a180f49bc63d1c Mon Sep 17 00:00:00 2001 From: mo8it Date: Sat, 17 May 2025 15:49:26 +0200 Subject: Add setup and usage pages --- website/content/setup/index.md | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 website/content/setup/index.md (limited to 'website/content/setup') diff --git a/website/content/setup/index.md b/website/content/setup/index.md new file mode 100644 index 0000000..7e628f8 --- /dev/null +++ b/website/content/setup/index.md @@ -0,0 +1,77 @@ ++++ +title = "Setup" ++++ + + + +## Installing Rust + +Before installing Rustlings, you need to have the **latest version of Rust** installed. +Visit [www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) for further instructions on installing Rust. +This will also install _Cargo_, Rust's package/project manager. + +> 🐧 If you are on Linux, make sure you have installed `gcc` (for a linker). +> +> Deb: `sudo apt install gcc` +> +> Dnf: `sudo dnf install gcc` + +> 🍎 If you are on MacOS, make sure you have installed Xcode and its developer tools by running `xcode-select --install`. + +## Installing Rustlings + +The following command will download and compile Rustlings: + +```bash +cargo install rustlings +``` + +
+If the installation fails… (click to expand) + +> - Make sure you have the latest Rust version by running `rustup update` +> - Try adding the `--locked` flag: `cargo install rustlings --locked` +> - Otherwise, please [report the issue](https://github.com/rust-lang/rustlings/issues/new) + +
+ +## Initialization + +After installing Rustlings, run the following command to initialize the `rustlings/` directory: + +```bash +rustlings init +``` + +
+If the command rustlings can't be found… (click to expand) + +> You are probably using Linux and installed Rust using your package manager. +> +> Cargo installs binaries to the directory `~/.cargo/bin`. +> Sadly, package managers often don't add `~/.cargo/bin` to your `PATH` environment variable. +> +> - Either add `~/.cargo/bin` manually to `PATH` +> - Or uninstall Rust from the package manager and [install it using the official way with `rustup`](https://www.rust-lang.org/tools/install) + +
+ +Now, go into the newly initialized directory and launch Rustlings for further instructions on getting started with the exercises: + +```bash +cd rustlings/ +rustlings +``` + +## Working environment + +### Editor + +Our general recommendation is [VS Code](https://code.visualstudio.com/) with the [rust-analyzer plugin](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). +But any editor that supports [rust-analyzer](https://rust-analyzer.github.io/) should be enough for working on the exercises. + +### Terminal + +While working with Rustlings, please use a modern terminal for the best user experience. +The default terminal on Linux and Mac should be sufficient. +On Windows, we recommend the [Windows Terminal](https://aka.ms/terminal). -- cgit v1.2.3 From 8339007633115125bf90b01b7839ce91fd97c4af Mon Sep 17 00:00:00 2001 From: mo8it Date: Sat, 17 May 2025 16:06:04 +0200 Subject: Update setup and usage --- website/content/setup/index.md | 4 ++++ website/content/usage/index.md | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'website/content/setup') diff --git a/website/content/setup/index.md b/website/content/setup/index.md index 7e628f8..14984a6 100644 --- a/website/content/setup/index.md +++ b/website/content/setup/index.md @@ -75,3 +75,7 @@ But any editor that supports [rust-analyzer](https://rust-analyzer.github.io/) s While working with Rustlings, please use a modern terminal for the best user experience. The default terminal on Linux and Mac should be sufficient. On Windows, we recommend the [Windows Terminal](https://aka.ms/terminal). + +## Usage + +After being done with the setup, visit the [**usage**](@/usage/index.md) page for some info about using Rustlings 🚀 diff --git a/website/content/usage/index.md b/website/content/usage/index.md index 44e24a2..7c8b0dd 100644 --- a/website/content/usage/index.md +++ b/website/content/usage/index.md @@ -16,7 +16,7 @@ Some exercises contain tests that need to pass for the exercise to be done ✅ Search for `TODO` and `todo!()` to find out what you need to change. Ask for hints by entering `h` in the _watch mode_ 💡 -### Watch Mode +## Watch Mode After the [initialization](@/setup/index.md#initialization), Rustlings can be launched by simply running the command `rustlings`. @@ -32,7 +32,7 @@ It will rerun the current exercise automatically every time you change the exerc -### Exercise List +## Exercise List In the [watch mode](#watch-mode) (after launching `rustlings`), you can enter `l` to open the interactive exercise list. -- cgit v1.2.3 From 8fa598ae7eb8c014657cea787376109b7f4c5d18 Mon Sep 17 00:00:00 2001 From: mo8it Date: Sat, 17 May 2025 20:20:19 +0200 Subject: Add details shortcode --- website/content/setup/index.md | 43 ++++++++++++++----------------- website/content/usage/index.md | 11 ++++---- website/input.css | 2 +- website/templates/shortcodes/details.html | 9 +++++++ 4 files changed, 35 insertions(+), 30 deletions(-) create mode 100644 website/templates/shortcodes/details.html (limited to 'website/content/setup') diff --git a/website/content/setup/index.md b/website/content/setup/index.md index 14984a6..db4ed40 100644 --- a/website/content/setup/index.md +++ b/website/content/setup/index.md @@ -6,17 +6,16 @@ title = "Setup" ## Installing Rust -Before installing Rustlings, you need to have the **latest version of Rust** installed. -Visit [www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) for further instructions on installing Rust. +Before installing Rustlings, you must have the **latest version of Rust** installed. +Visit [www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) for further instructions. This will also install _Cargo_, Rust's package/project manager. -> 🐧 If you are on Linux, make sure you have installed `gcc` (for a linker). +> 🐧 If you are on Linux, make sure you have `gcc` installed (_for a linker_). > -> Deb: `sudo apt install gcc` -> -> Dnf: `sudo dnf install gcc` +> Debian: `sudo apt install gcc`\ +> Fedora: `sudo dnf install gcc` -> 🍎 If you are on MacOS, make sure you have installed Xcode and its developer tools by running `xcode-select --install`. +> 🍎 If you are on MacOS, make sure you have _Xcode and its developer tools_ installed: `xcode-select --install` ## Installing Rustlings @@ -26,14 +25,13 @@ The following command will download and compile Rustlings: cargo install rustlings ``` -
-If the installation fails… (click to expand) +{% details(summary="If the installation fails…") %} -> - Make sure you have the latest Rust version by running `rustup update` -> - Try adding the `--locked` flag: `cargo install rustlings --locked` -> - Otherwise, please [report the issue](https://github.com/rust-lang/rustlings/issues/new) +- Make sure you have the latest Rust version by running `rustup update` +- Try adding the `--locked` flag: `cargo install rustlings --locked` +- Otherwise, please [report the issue](https://github.com/rust-lang/rustlings/issues/new) -
+{% end %} ## Initialization @@ -43,18 +41,17 @@ After installing Rustlings, run the following command to initialize the `rustlin rustlings init ``` -
-If the command rustlings can't be found… (click to expand) +{% details(summary="If the command rustlings can't be found…") %} -> You are probably using Linux and installed Rust using your package manager. -> -> Cargo installs binaries to the directory `~/.cargo/bin`. -> Sadly, package managers often don't add `~/.cargo/bin` to your `PATH` environment variable. -> -> - Either add `~/.cargo/bin` manually to `PATH` -> - Or uninstall Rust from the package manager and [install it using the official way with `rustup`](https://www.rust-lang.org/tools/install) +You are probably using Linux and installed Rust using your package manager. + +Cargo installs binaries to the directory `~/.cargo/bin`. +Sadly, package managers often don't add `~/.cargo/bin` to your `PATH` environment variable. + +- Either add `~/.cargo/bin` manually to `PATH` +- Or uninstall Rust from the package manager and [install it using the official way with `rustup`](https://www.rust-lang.org/tools/install) -
+{% end %} Now, go into the newly initialized directory and launch Rustlings for further instructions on getting started with the exercises: diff --git a/website/content/usage/index.md b/website/content/usage/index.md index 7c8b0dd..eecb7d2 100644 --- a/website/content/usage/index.md +++ b/website/content/usage/index.md @@ -23,14 +23,13 @@ After the [initialization](@/setup/index.md#initialization), Rustlings can be la This will start the _watch mode_ which walks you through the exercises in a predefined order (what we think is best for newcomers). It will rerun the current exercise automatically every time you change the exercise's file in the `exercises/` directory. -
-If detecting file changes in the exercises/ directory fails… (click to expand) +{% details(summary="If detecting file changes in the exercises/ directory fails…") %} -> You can add the **`--manual-run`** flag (`rustlings --manual-run`) to manually rerun the current exercise by entering `r` in the watch mode. -> -> Please [report the issue](https://github.com/rust-lang/rustlings/issues/new) with some information about your operating system and whether you run Rustlings in a container or virtual machine (e.g. WSL). +You can add the **`--manual-run`** flag (`rustlings --manual-run`) to manually rerun the current exercise by entering `r` in the watch mode. -
+Please [report the issue](https://github.com/rust-lang/rustlings/issues/new) with some information about your operating system and whether you run Rustlings in a container or virtual machine (e.g. WSL). + +{% end %} ## Exercise List diff --git a/website/input.css b/website/input.css index 3dd5501..b253675 100644 --- a/website/input.css +++ b/website/input.css @@ -41,7 +41,7 @@ @apply md:w-3/4 lg:w-3/5; } blockquote { - @apply px-3 pt-2 pb-0.5 my-4 border-s-4 border-white/80 bg-white/7 rounded-sm italic; + @apply px-3 pt-2 pb-0.5 my-4 border-s-4 border-white/80 bg-white/7 rounded-sm; } pre { diff --git a/website/templates/shortcodes/details.html b/website/templates/shortcodes/details.html new file mode 100644 index 0000000..c32d7c8 --- /dev/null +++ b/website/templates/shortcodes/details.html @@ -0,0 +1,9 @@ +
+ + {{ summary | safe }} (click to expand) + + +
+ {{ body | markdown | safe }} +
+
-- cgit v1.2.3 From dc468882cc00254b0b87fdcf39d9270d34e6adf8 Mon Sep 17 00:00:00 2001 From: mo8it Date: Sat, 17 May 2025 20:45:28 +0200 Subject: Highlight platform --- website/content/setup/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'website/content/setup') diff --git a/website/content/setup/index.md b/website/content/setup/index.md index db4ed40..54551ad 100644 --- a/website/content/setup/index.md +++ b/website/content/setup/index.md @@ -10,12 +10,12 @@ Before installing Rustlings, you must have the **latest version of Rust** instal Visit [www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) for further instructions. This will also install _Cargo_, Rust's package/project manager. -> 🐧 If you are on Linux, make sure you have `gcc` installed (_for a linker_). +> 🐧 If you are on **Linux**, make sure you have `gcc` installed (_for a linker_). > > Debian: `sudo apt install gcc`\ > Fedora: `sudo dnf install gcc` -> 🍎 If you are on MacOS, make sure you have _Xcode and its developer tools_ installed: `xcode-select --install` +> 🍎 If you are on **MacOS**, make sure you have _Xcode and its developer tools_ installed: `xcode-select --install` ## Installing Rustlings -- cgit v1.2.3