Demo post. This is sample content for testing the site, not a real article.
Showcase: code blocks
Syntax highlighting in nine languages, file names, highlighted lines, a long line that scrolls and plain text.

Every block below uses the server-side highlighter. Check the colours in light and dark mode, the language label, the copy button and the highlighted lines.
TypeScript with a file name
Lines 3 and 7 to 8 are highlighted.
type Entry<V> = { key: string; value: V }
export class HashMap<V> {
private buckets: Entry<V>[][] = Array.from({ length: 8 }, () => [])
set(key: string, value: V): void {
const bucket = this.buckets[this.index(key)]
const found = bucket.find((e) => e.key === key)
if (found) found.value = value
else bucket.push({ key, value })
}
private index(key: string): number {
let hash = 0
for (const ch of key) hash = (hash * 31 + ch.charCodeAt(0)) >>> 0
return hash % this.buckets.length
}
}Shell
# Deploy is a git push; the server does the rest
git push origin main
curl -fsS https://blog.kartikthakur.dev/api/health && echo "healthy"Python
from functools import lru_cache
@lru_cache(maxsize=None)
def fib(n: int) -> int:
"""Return the n-th Fibonacci number."""
return n if n < 2 else fib(n - 1) + fib(n - 2)
print([fib(i) for i in range(10)])SQL
SELECT c.name, count(p.id) AS articles
FROM categories c
LEFT JOIN posts p ON p.category_id = c.id AND p._status = 'published'
GROUP BY c.name
ORDER BY articles DESC;JSON and YAML
{
"name": "blog",
"private": true,
"scripts": { "dev": "next dev", "build": "next build" }
}jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm testA diff
- max_memory_restart: '700M'
+ max_memory_restart: '600M'
exec_mode: 'fork'A very long line
This block should scroll sideways instead of breaking the page layout.
const veryLongLine = ['alpha', 'bravo', 'charlie', 'delta', 'echo', 'foxtrot', 'golf', 'hotel', 'india', 'juliett', 'kilo', 'lima', 'mike', 'november', 'oscar', 'papa'].map((word, index) => `${index}:${word.toUpperCase()}`).join(' | ')Plain text
No highlighting here.
Indentation is kept.
Tabs and spaces too.

Comments
0