Testing Syntax Highlighting
This is a test post to verify that the syntax highlighting and copy button features are working correctly.
JavaScript Example
function fibonacci(n) {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
const result = fibonacci(10);
console.log(`Fibonacci of 10 is: ${result}`);TypeScript Example
interface User {
id: number;
name: string;
email: string;
role: 'admin' | 'user' | 'guest';
}
async function fetchUser(id: number): Promise<User> {
const response = await fetch(`/api/users/${id}`);
const user = await response.json();
return user;
}
const user: User = await fetchUser(1);Python Example
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
numbers = [3, 6, 8, 10, 1, 2, 1]
sorted_numbers = quicksort(numbers)
print(sorted_numbers)CSS Example
.container {
max-width: 1200px;
margin: 0 auto;
padding: 1rem 2rem;
}
.button {
background-color: #FDFF00;
color: #1A1A1A;
border: 2px solid #1A1A1A;
padding: 0.5rem 1rem;
transition: transform 0.15s ease;
}
.button:hover {
transform: translate(2px, 2px);
box-shadow: 2px 2px 0 #1A1A1A;
}Try hovering over the code blocks and clicking the copy button to test the functionality!