Code Samples — Multiple Languages
Code Samples
JavaScript
// Simple debounce examplefunction debounce(fn, wait) { let t; return function(...args) { clearTimeout(t); t = setTimeout(() => fn.apply(this, args), wait); };}
console.log('debounce ready');Python
def fib(n): a, b = 0, 1 for _ in range(n): a, b = b, a + b return a
print(fib(10))Rust
fn main() { let v = vec![1, 2, 3]; for x in v.iter() { println!("{}", x); }}Shell
#!/usr/bin/env bashecho "Hello from shell"SQL
SELECT id, title FROM posts WHERE published = true ORDER BY date DESC LIMIT 10;Expressive Code Features
Expressive Code provides syntax highlighting, titles, copy buttons, and line/text markers. The C++/C# tag on this sample also demonstrates labels containing reserved URL characters.
Code Block with a Title
// Simple debounce examplefunction debounce(fn, wait) { let t; return function(...args) { clearTimeout(t); t = setTimeout(() => fn.apply(this, args), wait); };}
console.log('debounce ready');Highlighted Lines
def fib(n): a, b = 0, 1 for _ in range(n): a, b = b, a + b return a
print(fib(10))Text Markers
fn main() { let v = vec![1, 2, 3]; for x in v.iter() { println!("{}", x); }}Line numbers and collapsible sections are optional Expressive Code plugins and are not enabled in this template. See the Expressive Code documentation for additional marker syntax.
Continue with the Markdown extensions sample. Its source filename resolves to its custom article slug automatically.