Syntax Highlighting Test
This is a test page to verify that syntax highlighting and copy buttons are working correctly.
JavaScript Example
JavaScript
function greet(name) {
console.log(`Hello, ${name}!`);
return `Welcome, ${name}!`;
}
const user = "World";
greet(user);
TypeScript Example
TypeScript
interface User {
id: number;
name: string;
email: string;
}
function createUser(userData: User): User {
return {
...userData,
id: Date.now(),
};
}
const newUser: User = createUser({
id: 1,
name: "John Doe",
email: "john@example.com"
});
React/JSX Example
JSX
import React, { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<h1>Count: {count}</h1>
<button onClick={() => setCount(count + 1)}>
Increment
</button>
</div>
);
}
export default Counter;
Bash Example
Bash
#!/bin/bash
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
CSS Example
CSS
.code-block {
background: #1a1a1a;
border: 1px solid #333;
border-radius: 8px;
padding: 1rem;
overflow-x: auto;
}
.syntax-highlight {
font-family: 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 1.5;
}
JSON Example
JSON
{
"name": "personal-blog",
"version": "1.0.0",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^15.0.0",
"react": "^19.0.0"
}
}
Plain Code Block (no language)
Code
This is a plain code block without syntax highlighting.
It should still have a copy button and basic styling.
All code blocks above should have:
- Syntax highlighting (colors)
- Language labels in the header
- Copy buttons that work when clicked
- Proper dark theme styling
Test the copy functionality by clicking the copy button on any code block!