MijiDoc支持HTML、CSS、Javascript、PHP、Python、GO等十多种类型的代码高亮展示;

1. HTML/XML (标记语言)

html
<!DOCTYPE html>
<html>
<head>
    <title>页面标题</title>
    <meta charset="UTF-8">
</head>
<body>
    <h1>主标题</h1>
    <div class="content">
        <p>段落文本 <a href="#">链接</a></p>
        <img src="image.jpg" alt="示例图片">
    </div>
</body>
</html>

2. CSS 示例 (简洁版)

/* 基础样式 */
body {
  font-family: 'Arial', sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f5f5f5;
}

/* 盒子模型 */
.card {
  width: 200px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

3. JavaScript (浏览器脚本)

// ES6+ 特性
const fetchData = async (url) => {
    try {
        const response = await fetch(url);
        const data = await response.json();
        console.log('获取数据:', data);
        
        // 箭头函数和模板字符串
        data.items.forEach(item => {
            console.log(`ID: ${item.id}, Name: ${item.name}`);
        });
    } catch (error) {
        console.error('请求失败:', error);
    }
};

// 类定义
class User {
    constructor(name) {
        this.name = name;
    }
    
    sayHello() {
        console.log(`Hello, ${this.name}!`);
    }
}