跳到主内容

技术Wiki详情

导入md wiki xr24

Wiki 综合测试文档

> 用途:测试 Markdown 导入、二次编辑、前台渲染、代码高亮、表格、列表、链接与图片路径。

1. 文本与排版

  • 粗体、*斜体*、~~删除线~~、行内代码
  • 有序列表和无序列表混合
  • 引用块、分隔线、任务列表

---

导入本地图片

导入网络图片

2. 任务清单

  • [x] 导入 Markdown
  • [x] 保存页面
  • [ ] 二次编辑回填验证
  • [ ] 前台展示验证

3. 引用块

> 这是测试引用块。

>

> - 引用子项 A

> - 引用子项 B

4. 表格测试

模块功能状态备注
Wiki 编辑Markdown/HTML 双模式正常支持模板插入
图片处理本地上传 + 网络缓存正常写入 docs 目录
删除清理页面+评论+目录正常双保险清理

5. 多语言代码块

5.1 JavaScript


function formatWikiTitle(title) {
  const safeTitle = String(title || '').trim();
  return safeTitle === '' ? 'Untitled Wiki' : safeTitle;
}

console.log(formatWikiTitle('Markdown 测试页'));

5.2 Python


def calc_sum(values):
    total = 0
    for item in values:
        total += item
    return total

print(calc_sum([1, 2, 3, 4]))

5.3 PHP


<?php
declare(strict_types=1);

function buildSlug(string $title): string
{
    $slug = strtolower(trim($title));
    $slug = preg_replace('/[^a-z0-9]+/', '-', $slug);
    return trim((string)$slug, '-');
}

echo buildSlug('Wiki Sample Page');

5.4 SQL


SELECT id, title, slug, status
FROM wiki_pages
WHERE status = 1
ORDER BY id DESC
LIMIT 20;

5.5 Bash


php scripts/repair_wiki_markdown_contract.php

5.6 JSON


{
  "module": "wiki",
  "test_case": "full_markdown_sample",
  "features": ["code", "table", "quote", "list", "image"]
}

5.7 C


#include <stdio.h>

int sum_array(const int *arr, int length) {
    int total = 0;
    int i = 0;
    for (i = 0; i < length; ++i) {
        total += arr[i];
    }
    return total;
}

int main(void) {
    int values[] = {1, 3, 5, 7};
    int result = sum_array(values, 4);
    printf("sum=%d\n", result);
    return 0;
}

5.8 C++


#include <iostream>
#include <vector>
#include <numeric>

class WikiScoreCalculator {
public:
    int calc(const std::vector<int>& scores) const {
        return std::accumulate(scores.begin(), scores.end(), 0);
    }
};

int main() {
    WikiScoreCalculator calculator;
    std::vector<int> scores{10, 20, 30};
    std::cout << "total=" << calculator.calc(scores) << std::endl;
    return 0;
}

5.9 C#


using System;
using System.Collections.Generic;
using System.Linq;

public class WikiTagService
{
    public string JoinTags(List<string> tags)
    {
        return string.Join(", ", tags.Where(tag => !string.IsNullOrWhiteSpace(tag)));
    }
}

public static class Program
{
    public static void Main()
    {
        var service = new WikiTagService();
        var tags = new List<string> { "wiki", "markdown", "render" };
        Console.WriteLine(service.JoinTags(tags));
    }
}

6. 链接与图片

本地图片示例

7. 结论

这份文档用于验证:

  1. 导入后保存是否生成 index.md
  2. 二次编辑是否能完整回填
  3. 前台渲染是否和后台一致
  4. 删除后资源是否清理彻底

评论留言(论坛样式,需管理员审核后显示)

当前身份:游客(将显示IP)

已审核评论

xuxin 2026-04-29 15:36

sdfs