This post demonstrates code blocks with syntax highlighting and mathematical equations.
Code Blocks
JavaScript
function greet(name) { console.log(`Hello, ${name}!`)}
greet('World')TypeScript with Line Numbers
interface User { id: number name: string email: string}
function getUser(id: number): User | undefined { const users: User[] = [ { id: 1, name: 'Alice', email: 'alice@example.com' }, { id: 2, name: 'Bob', email: 'bob@example.com' }, ] return users.find(user => user.id === id)}Line Highlighting
def fibonacci(n): if n <= 1: return n return fibonacci(n - 1) + fibonacci(n - 2)
print(fibonacci(10))Terminal Commands
npm install astronpm run devDiff Syntax
const old = 'removed'const new = 'added'JSON Configuration
{ "name": "my-blog", "scripts": { "dev": "astro dev", "build": "astro build" }}Mathematics
Inline Math
The famous equation shows the relationship between energy and mass.
The quadratic formula is .
Block Equations
The Gaussian integral:
Euler’s identity:
A matrix example: