样式测试文章
这是一个用于测试样式修改的测试文章。
测试代码块宽度和语法高亮
下面是一个Python代码块,应该占满文章宽度:
import numpy as np import pandas as pd import matplotlib.pyplot as plt
def calculate_statistics(data): """计算数据的统计信息""" mean = np.mean(data) std = np.std(data) median = np.median(data) return { 'mean': mean, 'std': std, 'median': median, 'range': (np.min(data), np.max(data)) }
np.random.seed(42) data = np.random.normal(0, 1, 1000) stats = calculate_statistics(data)
print(f"平均值: {stats['mean']:.4f}") print(f"标准差: {stats['std']:.4f}") print(f"中位数: {stats['median']:.4f}")
|
测试JavaScript代码块
const users = [ { id: 1, name: 'Alice', age: 25 }, { id: 2, name: 'Bob', age: 30 }, { id: 3, name: 'Charlie', age: 35 } ];
const adultUsers = users.filter(user => user.age >= 18); const userNames = users.map(user => user.name); const totalAge = users.reduce((sum, user) => sum + user.age, 0);
async function fetchUserData(userId) { try { const response = await fetch(`/api/users/${userId}`); const data = await response.json(); return data; } catch (error) { console.error('Error fetching user data:', error); throw error; } }
|
测试短代码块
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>测试页面</title> </head> <body> <h1>Hello World</h1> <p>这是一个测试页面。</p> </body> </html>
|
测试CSS代码块
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.card { background: white; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); padding: 20px; transition: transform 0.3s ease; }
.card:hover { transform: translateY(-4px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.button { display: inline-block; padding: 10px 20px; background: #007bff; color: white; border-radius: 4px; text-decoration: none; transition: background 0.3s ease; }
.button:hover { background: #0056b3; }
|
测试JSON代码块
{ "name": "样式测试", "version": "1.0.0", "description": "用于测试代码块样式的配置文件", "settings": { "theme": "dark", "fontSize": 14, "lineHeight": 1.6, "tabSize": 4 }, "features": { "syntaxHighlighting": true, "codeFolding": true, "lineNumbers": true, "copyButton": true } }
|
测试Markdown代码块
# Markdown示例
这是一个Markdown代码块,用于测试语法高亮。
## 二级标题
- 列表项1 - 列表项2 - 列表项3
**粗体文本** *斜体文本*
> 引用文本
[链接文本](https://example.com)

|
测试小代码块
echo "Hello World" ls -la cd ~/Documents
|
测试无标题文章(TOC应该隐藏)
这个文章没有H2-H4标题,所以TOC应该完全隐藏,不占位置。
H3标题(应该出现在TOC中)
这是H3标题的内容。
H4标题(应该出现在TOC中)
这是H4标题的内容。
测试表格
| 姓名 |
年龄 |
城市 |
| 张三 |
25 |
北京 |
| 李四 |
30 |
上海 |
| 王五 |
28 |
广州 |
测试图片

测试引用
这是一个引用块,用于测试样式。
引用块应该有自己的样式,与普通段落区分开。
测试列表
无序列表
有序列表
- 第一步
- 第二步
- 第三步
测试内联代码
在段落中使用 inline code 来测试内联代码样式。
测试强调
粗体文本 和 斜体文本 应该正确显示。
测试链接
访问 Hexo官网 获取更多信息。
文章结束,所有样式应该正常工作。