代码高亮测试

代码高亮测试

这是一个测试代码高亮功能的文章。

JavaScript 代码示例

1
2
3
4
5
6
7
function helloWorld() {
console.log("Hello, World!");
return "Hello from JavaScript!";
}

// 调用函数
helloWorld();

Python 代码示例

1
2
3
4
5
6
def hello_world():
print("Hello, World!")
return "Hello from Python!"

# 调用函数
hello_world()

CSS 代码示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 20px;
}

.container {
max-width: 1200px;
margin: 0 auto;
background-color: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

HTML 代码示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!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>
<div class="container">
<h1>欢迎来到测试页面</h1>
<p>这是一个测试代码高亮的页面。</p>
</div>
</body>
</html>

C++ 代码示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <string>

class HelloWorld {
public:
HelloWorld() {}

void sayHello() {
std::cout << "Hello, World!" << std::endl;
}

std::string getMessage() {
return "Hello from C++!";
}
};

int main() {
HelloWorld hw;
hw.sayHello();
std::cout << hw.getMessage() << std::endl;
return 0;
}

行内代码示例

这里有一些行内代码:console.log("Hello")print("Hello")

总结

如果代码高亮功能正常工作,你应该能看到不同编程语言的代码块都有不同的颜色高亮显示。

  • Copyrights © 2025 Kaleid Scoper
  • 访问人数: | 浏览次数:

欢迎打赏支持作者

支付宝
微信