Testing Code Syntax Highlighting
A comprehensive test of code syntax highlighting across multiple programming languages including JavaScript, TypeScript, Python, SQL, and more.
Testing Code Syntax Highlighting
This is a test post to demonstrate code syntax highlighting with Prism.js.
JavaScript Example
Here's a simple React component:
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;
TypeScript Example
A typed version with interfaces:
interface User {
id: string;
name: string;
email: string;
}
async function fetchUser(id: string): Promise<User> {
const response = await fetch(`/api/users/${id}`);
const data = await response.json();
return data;
}
Python Example
A simple Flask API endpoint:
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/api/hello')
def hello():
return jsonify({
'message': 'Hello World!',
'status': 'success'
})
if __name__ == '__main__':
app.run(debug=True)
SQL Example
Database query:
SELECT u.id, u.name, COUNT(p.id) as post_count
FROM users u
LEFT JOIN posts p ON u.id = p.user_id
WHERE u.active = true
GROUP BY u.id, u.name
ORDER BY post_count DESC
LIMIT 10;
JSON Example
API response:
{
"status": "success",
"data": {
"user": {
"id": "123",
"name": "John Doe",
"email": "john@example.com"
}
},
"timestamp": "2025-12-15T10:30:00Z"
}
Bash Example
Deployment script:
#!/bin/bash
echo "Starting deployment..."
npm install
npm run build
if [ $? -eq 0 ]; then
echo "Build successful!"
pm2 restart app
else
echo "Build failed!"
exit 1
fi
CSS Example
Styling example:
.button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 12px 24px;
border-radius: 8px;
border: none;
cursor: pointer;
transition: transform 0.2s;
}
.button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
Inline Code
You can also use inline code like const greeting = "Hello World" within text.
Conclusion
This demonstrates that our code syntax highlighting is working across multiple programming languages!
Comments (0)
Leave a Comment
Ready to Get Started?
Join SaaSBuilderPro and get access to the complete roadmap, AI builders, and launch templates.
See Plans & Join