Astro博客重构

/post/blog-migration article cover image

heading-1

heading-2

heading-3

code elements:

Lorem ipsum dolor sit amet consectetur adipisicing elit. referrence "A" Animi soluta possimus unde dolorem. Error deserunt, deleniti autem voluptate consectetur distinctio!

NAMEROLESTATUS
Tony ReichertCEOActive
Zoey LangTechnical LeadVacation

Info Tip

When working with JSX, parts of your code are translated into structured HTML that is placed at the start of the file. Static elements are processed differently from dynamic ones, which might change based on data or user actions. For dynamic elements, special markers are added for better handling during rendering.

Warnning Tip

When working with JSX, parts of your code are translated into structured HTML that is placed at the start of the file. Static elements are processed differently from dynamic ones, which might change based on data or user actions. For dynamic elements, special markers are added for better handling during rendering.

Error Tip

When working with JSX, parts of your code are translated into structured HTML that is placed at the start of the file. Static elements are processed differently from dynamic ones, which might change based on data or user actions. For dynamic elements, special markers are added for better handling during rendering.

Successful Tip

When working with JSX, parts of your code are translated into structured HTML that is placed at the start of the file. Static elements are processed differently from dynamic ones, which might change based on data or user actions. For dynamic elements, special markers are added for better handling during rendering.

These are code blocks:

ts
globalStyle(`${CONTENT_ID} table`, {
  width: "100%",
  margin: `${vars.space[6]} 0`,
  padding: vars.space[4],
  borderSpacing: 0,
  borderCollapse: "separate",
  backgroundColor: blueGray[800],
  borderRadius: vars.borderRadius.lg,
  border: `${rem(1)} solid ${blueGray[700]}`,
  overflow: "hidden"
})

globalStyle(`${CONTENT_ID} thead`, {
  backgroundColor: blueGray[700],
  borderBottom: `1px solid ${blueGray[600]}`
})

globalStyle(`${CONTENT_ID} th`, {
  padding: `${vars.space[3]} ${vars.space[5]}`,
  textAlign: "left",
  fontWeight: 500,
  fontSize: vars.fontSize.sm,
  color: blueGray[200],
  border: "none"
})

globalStyle(`${CONTENT_ID} thead th:first-of-type`, {
  borderTopLeftRadius: vars.borderRadius.lg,
  borderBottomLeftRadius: vars.borderRadius.lg
})

globalStyle(`${CONTENT_ID} thead th:last-of-type`, {
  borderTopRightRadius: vars.borderRadius.lg,
  borderBottomRightRadius: vars.borderRadius.lg
})

globalStyle(`${CONTENT_ID} tbody tr`, {
  transition: "background-color 0.2s ease"
})

globalStyle(`${CONTENT_ID} td`, {
  padding: `${vars.space[4]} ${vars.space[5]}`,
  borderTop: `${rem(1)} solid ${blueGray[700]}`,
  color: blueGray[100],
  fontSize: vars.fontSize.sm
})

globalStyle(`${CONTENT_ID} tbody tr:hover`, {
  backgroundColor: blueGray[700]
})

globalStyle(`${CONTENT_ID} tbody tr:last-of-type td`, {
  borderBottom: "none"
})
js
const fetchData = async (url) => {
  const response = await fetch(url);
  const data = await response.json();
  return data.results.map(item => item.name);
};
ts
interface Config {
  apiKey: string;
  timeout: number;
}

const initApp = (config: Config): void => {
  console.log(`Initializing with key: ${config.apiKey}`);
};
tsx
import { useState } from 'react';

export default function TodoList() {
  const [todos, setTodos] = useState<string[]>([]);

  return (
    <ul>
      {todos.map((todo, i) => <li key={i}>{todo}</li>)}
    </ul>
  );
}
css
.card {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  background: linear-gradient(to bottom, #f3f4f6, #e5e7eb);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
html
<!DOCTYPE html>
<html>
  <head>
    <title>My Page</title>
  </head>
  <body>
    <nav><a href="/">Home</a></nav>
    <main><h1>Welcome</h1></main>
  </body>
</html>
dart
void main() {
  List<int> numbers = [1, 2, 3, 4, 5];
  var doubled = numbers.map((n) => n * 2).toList();
  print(doubled);  // [2, 4, 6, 8, 10]

  fibonacci(10).forEach(print);
}

Iterable<int> fibonacci(int n) sync* {
  int a = 0, b = 1;
  while (n-- > 0) {
    yield a;
    int next = a + b;
    a = b;
    b = next;
  }
}
shell
#!/bin/bash
for file in *.txt; do
  echo "Processing $file"
  wc -l "$file"
done
json
{
  "desensitizationRules": {
    "name": {
      "type": "NAME",
      "keepFront": 1,
      "keepEnd": 0,
      "replaceChar": "*"
    },
    "phone": {
      "type": "PHONE",
      "keepFront": 3,
      "keepEnd": 4,
      "replaceChar": "*"
    },
    "email": {
      "type": "EMAIL",
      "keepFront": 2,
      "replaceWith": "***@example.com"
    }
  },
  "enabled": true,
  "logLevel": "INFO"
}
yaml
server:
  port: 8080
  servlet:
    context-path: /api

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/userdb?useSSL=false&serverTimezone=Asia/Shanghai
    username: ${DB_USER:root}
    password: ${DB_PASS:password}
    driver-class-name: com.mysql.cj.jdbc.Driver
  redis:
    host: localhost
    port: 6379
    password: ${REDIS_PASS:}

cors:
  allowed-origins:
    - "http://localhost:3000"
    - "https://your-frontend.com"
  allowed-methods: ["GET", "POST", "PUT", "DELETE"]
  allowed-headers: ["*"]
  expose-headers: ["Authorization"]
  max-age: 3600

jwt:
  secret: "your-super-secret-jwt-key-must-be-256-bits-long"
  expiration: 86400000  # 24小时(毫秒)
  issuer: "your-app"

logging:
  level:
    root: INFO
    org.springframework.web: DEBUG
  file:
    name: logs/app.log
rust
fn fibonacci(n: u32) -> u32 {
    match n {
        0 => 0,
        1 => 1,
        _ => fibonacci(n - 1) + fibonacci(n - 2),
    }
}
wasm
(module
  (func $add (param i32 i32) (result i32)
    (local.get 0)
    (local.get 1)
    (i32.add)
  )
  (export "add" (func $add))
)
prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique
  name      String?
  role      Role     @default(USER)
  posts     Post[]
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model Post {
  id        Int      @id @default(autoincrement())
  title     String
  content   String?
  published Boolean  @default(false)
  author    User     @relation(fields: [authorId], references: [id])
  authorId  Int
  createdAt DateTime @default(now())
}

enum Role {
  USER
  ADMIN
}
graphql
type Query {
  users: [User!]!
  user(id: ID!): User
  posts: [Post!]!
  post(id: ID!): Post
}

type Mutation {
  createUser(email: String!, name: String): User!
  updateUser(id: ID!, name: String): User!
  deleteUser(id: ID!): Boolean!
  createPost(title: String!, content: String, authorEmail: String!): Post!
}

type User {
  id: ID!
  email: String!
  name: String
  role: Role!
  posts: [Post!]!
  createdAt: String!
}

type Post {
  id: ID!
  title: String!
  content: String
  published: Boolean!
  author: User!
  createdAt: String!
}

enum Role {
  USER
  ADMIN
}
python
def calculate_average(numbers: list[float]) -> float:
    if not numbers:
        return 0.0
    return sum(numbers) / len(numbers)

print(calculate_average([1, 2, 3, 4, 5]))