Here is some inline code mixed with regular text. You can use let x = 42 in Rust, or print("hello") in Python. Variables like my_var and functions like fetchData() should look distinct. Paths such as ~/.config/zola/config.toml and commands like zola serve also appear inline. Sometimes you need --border-radius: 12px or HashMap<String, i32>.
Rust
use std::collections::HashMap;
fn main() {
let mut scores: HashMap<String, i32> = HashMap::new();
scores.insert(String::from("Blue"), 10);
scores.insert(String::from("Red"), 50);
for (key, value) in &scores {
println!("{}: {}", key, value);
}
let result = match scores.get("Blue") {
Some(&v) => v * 2,
None => 0,
};
println!("Result: {}", result);
}Python
from dataclasses import dataclass
from typing import Optional
@dataclass
class User:
name: str
email: str
age: Optional[int] = None
def greet(self) -> str:
return f"Hello, {self.name}!"
users = [User("Alice", "alice@example.com", 30),
User("Bob", "bob@example.com")]
for user in users:
print(user.greet())JavaScript
async function fetchData(url) {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
return data.map(({ id, name }) => ({ id, name: name.toUpperCase() }));
} catch (error) {
console.error("Failed:", error.message);
return [];
}
}Go
package main
import (
"fmt"
"sync"
)
func main() {
var wg sync.WaitGroup
ch := make(chan int, 3)
for i := 0; i < 5; i++ {
wg.Add(1)
go func(id int) {
defer wg.Done()
ch <- id * 2
}(i)
}
go func() {
wg.Wait()
close(ch)
}()
for val := range ch {
fmt.Println("Received:", val)
}
}Bash
#!/usr/bin/env bash
set -euo pipefail
deploy() {
local env="${1:-staging}"
local timestamp=$(date +%Y%m%d_%H%M%S)
echo "Deploying to $env at $timestamp"
rsync -avz --delete ./public/ "server:~/sites/$env/"
echo "Done!"
}
deploy "$@"CSS
:root {
--primary: #3273dc;
--bg: #ffffff;
}
@media (prefers-color-scheme: dark) {
:root {
--primary: #8cc2dd;
--bg: #01242e;
}
}
.card {
background: var(--bg);
border-radius: 8px;
padding: 1.5rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.2s ease;
}
.card:hover {
transform: translateY(-2px);
}TOML
[server]
host = "0.0.0.0"
port = 8080
[database]
url = "postgres://localhost:5432/mydb"
max_connections = 20
[[users]]
name = "Alice"
role = "admin"
[[users]]
name = "Bob"
role = "viewer"SQL
SELECT u.name, COUNT(o.id) AS order_count, SUM(o.total) AS total_spent
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE o.created_at >= '2025-01-01'
GROUP BY u.name
HAVING COUNT(o.id) > 5
ORDER BY total_spent DESC
LIMIT 10;JSON
{
"name": "my-project",
"version": "2.0.0",
"dependencies": {
"react": "^18.2.0",
"typescript": "^5.3.0"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"test": "vitest --coverage"
}
}