You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [Rust Playpen](https://github.com/rust-lang/rust-playpen) is a way to experiment with Rust code through a web interface. This project is now commonly referred to as [Rust Playground](https://play.rust-lang.org/).
4
+
5
+
## Using it with `mdbook`
6
+
7
+
In [`mdbook`][mdbook], you can make code examples playable and editable.
8
+
9
+
```rust,editable
10
+
fn main() {
11
+
println!("Hello World!");
12
+
}
13
+
```
14
+
15
+
This allows the reader to both run your code sample, but also modify and tweak it. The key here is the adding the word `editable` to your codefence block separated by a comma.
16
+
17
+
````markdown
18
+
```rust,editable
19
+
//...place your code here
20
+
```
21
+
````
22
+
23
+
## Using it with docs
24
+
25
+
You may have noticed in some of the [official Rust docs][official-rust-docs] a button that says "Run", which opens the code sample up in a new tab in Rust Playground. This feature is enabled if you use the #[doc] attribute called [`html_playground_url`][html-playground-url].
0 commit comments