Code Block Style Test

A rust code block

// A simple Rust function
fn fibonacci(n: u32) -> u32 {
    match n {
        0 => 0,
        1 => 1,
        _ => fibonacci(n - 1) + fibonacci(n - 2),
    }
}

fn main() {
    let result = fibonacci(10);
    println!("The 10th Fibonacci number is: {}", result);
}

Inline code Elements

When working with Rust variables like let x = 42; or functions like fibonacci(), it's important to remember that u32 and i32 are different types.

Keyboard kbd Elements

Press Ctrl + Shift + P to open the command palette.

Sample Output samp Elements

Terminal output: cargo build --release

Mixed Inline Elements

The Option<T> type in Rust can be Some(T) or None. When you run the program you might see Hello, world! as output.

Complex Code Block

// A more complex Rust example
use std::collections::HashMap;

struct Cache {
    data: HashMap<String, String>,
}

impl Cache {
    fn new() -> Self {
        Cache {
            data: HashMap::new(),
        }
    }

    fn insert(&mut self, key: &str, value: &str) -> Option<String> {
        self.data.insert(key.to_string(), value.to_string())
    }

    fn get(&self, key: &str) -> Option<&String> {
        self.data.get(key)
    }
}

fn main() {
    let mut cache = Cache::new();
    cache.insert("name", "Rust");

    if let Some(value) = cache.get("name") {
        println!("Found: {}", value);
    }
}

Tab-indented code block

Indentation uses real tab characters, which must expand to spaces rather than leaking a raw \t into the terminal and overflowing the box.

fn bucket_fallback() -> impl Bundle {
	(
		HandlerConditions::fallback(),
		bucket_file_handler(),
		related!{Endpoints[
			bundle_endpoint(|| rsx!{<div>fallback</div>})
		]}
	)
}