mdBook
https://rust-lang.github.io/mdBook/format/markdown.html
|
|
Hiding code lines
```rust
# fn main() {
let x = 5;
let y = 6;
println!("{}", x + y);
# }
```
```java,hidelines=//
public int getId(){
//this line will hide
return this.id;
}
```
```python,hidelines=~
~hidden()
nothidden():
~ hidden()
~hidden()
nothidden()
```
```python,hidelines=!!!
!!!hidden()
nothidden():
!!! hidden()
!!!hidden()
nothidden()
```
Rust Playground
```rust,playground
#![allow(unused)]
fn main() {
println!(“Hello, World!”);
}
```
```rust,noplayground
let mut name = String::new();
std::io::stdin().read_line(&mut name).expect(“failed to read line”);
println!(“Hello {}!”, name);
```
Rust code block attributes
```rust,ignore
# This example won’t be tested.
panic!(“oops!”);
```
Including files
```rust
{{#include file.rs}}
```
```java
{{#include ../../../hello.java}}
```
Including portions of a file
```rust
{{#include file.rs:2}}
{{#include file.rs::10}}
{{#include file.rs:2:}}
{{#include file.rs:2:10}}
```
book.toml
|
|