Hello, World

Testing all blog components - code blocks, callouts, dividers, and TOC.

First post. Testing all available components.

Code blocks

Plain block with lang tag and copy button:

fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

fn main() {
    println!("{}", greet("world"));
}

Block with external link button:

fn greet(name: &str) -> String {
    format!("Hello, {}!", name)
}

fn main() {
    println!("{}", greet("world"));
}

Inline code looks like this.

01 - CALLOUT BLOCKS

Callouts

NOTE

Default callout. Uses the green accent. Good for general notes and observations.

KEY INSIGHT

Teal callout. Use for important takeaways, things worth remembering.

INFO

Blue callout. Good for background context or supplementary information.

WARNING

Yellow callout. Use for gotchas, caveats, things that need attention.

DANGER ZONE

Salmon callout. Reserve for unsafe code, footguns, things that can go wrong badly.

02 - MORE LANGUAGES

Other languages

const std = @import("std");

pub fn main() void {
    const msg = "hello, world";
    std.debug.print("{s}\n", .{msg});
}
#include <stdio.h>

int main(void) {
    printf("hello, world\n");
    return 0;
}
[package]
name = "example"
version = "0.1.0"
edition = "2021"

[dependencies]
serde = { version = "1", features = ["derive"] }
03 - COMPARISON TABLE

Tables

FeatureRustZigC
Memory safetyCompile-time borrow checkerOptional, manualManual
Build systemCargoBuilt-in zig buildMake / CMake
Error handlingResult<T, E>Error unionsReturn codes
Null safetyNo null, use Option<T>Optional types ?TNullable pointers
Compile speedSlowFastFast
RuntimeZero-cost abstractionsZero-costZero-cost