All posts

Test code block

Linh Nguyen T. H.'s avatarLinh Nguyen T. H.
function fibonacci(n) {
  if (n <= 1) return n;

  let a = 0;
  let b = 1;

  for (let i = 2; i <= n; i++) {
    [a, b] = [b, a + b];
  }

  return b;
}

console.log(fibonacci(10)); // 55

interface User {
  id: number;
  name: string;
  email?: string;
}

const users: User[] = [
  { id: 1, name: "Alice" },
  { id: 2, name: "Bob", email: "bob@example.com" },
];

const getUser = (id: number): User | undefined =>
  users.find((user) => user.id === id);

console.log(getUser(2));

import { useState } from "react";

export default function Counter() {
  const [count, setCount] = useState(0);

  return (
    <button onClick={() => setCount((prev) => prev + 1)}>
      Count: {count}
    </button>
  );
}

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Hello World</title>
  </head>
  <body>
    <h1>Hello, Markdown!</h1>
    <button onclick="alert('Clicked!')">
      Click me
    </button>
  </body>
</html>

.card {
  max-width: 480px;
  padding: 1rem;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
}

from dataclasses import dataclass

@dataclass
class Book:
    title: str
    author: str

books = [
    Book("Clean Code", "Robert C. Martin"),
    Book("Refactoring", "Martin Fowler"),
]

for book in books:
    print(f"{book.title} - {book.author}")

public class Main {
    public static void main(String[] args) {
        String message = "Hello Java";

        for (int i = 0; i < 3; i++) {
            System.out.println(message);
        }
    }
}

SELECT
    u.id,
    u.name,
    COUNT(o.id) AS total_orders
FROM users u
LEFT JOIN orders o
    ON u.id = o.user_id
GROUP BY u.id, u.name
ORDER BY total_orders DESC;

#!/bin/bash

echo "Backup started..."

tar -czf backup.tar.gz ./project

echo "Done!"

{
  "name": "ChatGPT",
  "version": "5.5",
  "features": [
    "markdown",
    "code blocks",
    "syntax highlighting"
  ],
  "active": true
}

FROM node:22-alpine

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "start"]

<?xml version="1.0" encoding="UTF-8"?>
<books>
  <book id="1">
    <title>Clean Code</title>
    <author>Robert C. Martin</author>
  </book>
</books>

#include <iostream>
#include <vector>

int main() {
    std::vector<int> nums = {1, 2, 3, 4, 5};

    for (int n : nums) {
        std::cout << n << " ";
    }

    return 0;
}

Lorem ipsum dolor sit amet,
consectetur adipiscing elit.

0123456789
!@#$%^&*()_+
漢字 かな 한국어 Tiếng Việt 😀

Đây là một đoạn văn bản thuần (plain text) bằng tiếng Việt.

Nó không chứa bất kỳ định dạng nào như in đậm, in nghiêng hay liên kết.
Mục đích của đoạn này là để kiểm tra khả năng hiển thị của code block.

Một vài ký tự đặc biệt:
! @ # $ % ^ & * ( ) _ + - = [ ] { } \ | ; : ' " < > , . ? /

Một vài con số:
0 1 2 3 4 5 6 7 8 9

Tiếng Việt có dấu:
Tôi yêu lập trình, thiết kế giao diện và chia sẻ kiến thức.
Hôm nay trời đẹp, nhiệt độ khoảng 30°C.
Chúc bạn có một ngày làm việc hiệu quả! 🚀