Python — Hello World
The classic hello-world in idiomatic Python 3, with a shebang, a module docstring, and the standard main guard — the minimal correct program for testing highlighters and interpreters.
Idiomatic hello-world programs and realistic snippets across sixteen languages, exercising comments, string escapes, interpolation, numeric literals, and language keywords — for testing syntax highlighters, editor themes, and tree-sitter grammars.
The classic hello-world in idiomatic Python 3, with a shebang, a module docstring, and the standard main guard — the minimal correct program for testing highlighters and interpreters.
A realistic Python snippet exercising type hints, an lru_cache-memoised recursive function, a generator, and a frozen dataclass — for testing syntax highlighters, linters (ruff/flake8), and formatters (black).
The classic hello-world in modern JavaScript — a minimal function calling console.log, for testing highlighters, Node, and JS parsers.
A realistic JavaScript snippet with an ES class, private #fields, arrow functions, template literals, a getter, and async/await — for testing highlighters, ESLint, Prettier, and bundlers.
The classic hello-world in TypeScript (shipped as .mts to avoid the MPEG-TS .ts collision) — a typed function for testing TypeScript-aware highlighters and the tsc compiler.
A realistic TypeScript snippet with an enum, a discriminated union, generics, exhaustive switch handling, and a typed reduce — for testing the type checker, highlighters, and the TS ESLint parser.
A minimal, valid HTML5 document — doctype, head, and a single heading — for testing HTML parsers, highlighters, and validators against the simplest well-formed page.
A realistic semantic HTML page with landmark elements (header, nav, main, article, footer), a figure with alt text and caption, and lists — for testing HTML parsers, accessibility tooling, and highlighters.
A minimal stylesheet that centres a heading with grid — the simplest useful CSS file for testing highlighters, CSS parsers, and minifiers.
A realistic component stylesheet using custom properties, flexbox, a fluid clamp() font size, color-mix(), a keyframe animation, and a media query — for testing CSS parsers, linters (stylelint), and highlighters.
The classic hello-world in Java — a public class with the standard main method — for testing highlighters, javac, and Java parsers.
A realistic Java class with a package declaration, fields, a nested record, methods that throw exceptions, and formatted output — for testing highlighters, javac, Checkstyle, and parsers.
The classic hello-world in C — an include, main, and printf — for testing highlighters, C compilers, and parsers against the canonical first program.
A realistic C program: a singly linked list with a typedef struct, malloc/free memory management, pointer walking, and error handling — for testing highlighters, compilers, and static analysers.
The classic hello-world in C++ — iostream and std::cout — for testing highlighters, C++ compilers, and parsers.
A realistic C++ snippet with a class template, STL algorithms (max_element, accumulate), std::move, and range handling — for testing highlighters, g++/clang++, and parsers against real templates.
The classic hello-world in Go — package main, an import, and fmt.Println, tab-indented like gofmt — for testing highlighters, the Go compiler, and parsers.
A realistic Go program: a worker pool with structs and methods, goroutines, buffered channels, and a sync.WaitGroup — tab-indented like gofmt, for testing highlighters, go vet, and parsers.
The classic hello-world in Rust — fn main and the println! macro — for testing highlighters, rustc, and parsers.
A realistic Rust snippet with an enum carrying data, a trait and impl, exhaustive match, iterators, and Option handling — for testing highlighters, rustc, clippy, and parsers against real ownership-era code.
The classic hello-world in PHP — an opening tag and echo — for testing highlighters, the PHP interpreter, and parsers.
A realistic modern-PHP snippet with strict types, a namespace, a backed enum, a final class with constructor-promoted readonly properties, and array_reduce with an arrow function — for testing highlighters, PHPStan, and parsers.
The classic hello-world in Ruby — a single puts — for testing highlighters, the Ruby interpreter, and parsers.
A realistic Ruby snippet: a Stack class that mixes in Enumerable, yields blocks, raises a custom error class, and uses string interpolation and symbol-to-proc — for testing highlighters, RuboCop, and parsers.
The classic hello-world in Bash — a shebang and echo, with LF line endings so it runs on Unix — for testing highlighters, ShellCheck, and shell parsers.
A realistic Bash script using strict mode (set -euo pipefail), functions, default parameters, a loop, and conditionals — an illustrative fixture (review before running) for testing highlighters, ShellCheck, and shfmt.
The classic first query in SQL — a single SELECT of a literal — for testing highlighters, SQL parsers, and query editors.
A realistic SQL script with CREATE TABLE constraints and foreign keys, INSERT seed data, a CREATE VIEW, and a grouped aggregate query with a join — for testing SQL parsers, formatters, and highlighters.
The classic hello-world in Kotlin — a top-level main function — for testing highlighters, the Kotlin compiler, and parsers.
A realistic Kotlin snippet with data classes, an enum, a sealed result interface, extension functions, and when expressions — for testing highlighters, the Kotlin compiler, ktlint, and parsers.
The classic hello-world in Swift — a single print — for testing highlighters, the Swift compiler, and parsers.
A realistic Swift snippet with an enum, a protocol, a struct with a computed property, optionals and optional binding, and higher-order functions — for testing highlighters, the Swift compiler, SwiftLint, and parsers.
A sample cache-first service worker handling install, activate, and fetch events with an offline fallback — for testing service-worker registration, JS parsers, and PWA tooling.
We use Google Analytics. It sets no analytics cookies until you allow the Analytics category below. See our cookie policy.