Add files via upload

This commit is contained in:
公明
2026-01-28 19:49:34 +08:00
committed by GitHub
parent 7c35c93f23
commit 068dbc1209
3 changed files with 3936 additions and 8 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -225,11 +225,18 @@ function renderParameters(endpoint) {
const rows = params.map(param => {
const required = param.required ? '<span class="api-param-required">必需</span>' : '<span class="api-param-optional">可选</span>';
// 处理描述文本,将换行符转换为<br>
let descriptionHtml = '-';
if (param.description) {
const escapedDesc = escapeHtml(param.description);
descriptionHtml = escapedDesc.replace(/\n/g, '<br>');
}
return `
<tr>
<td><span class="api-param-name">${param.name}</span></td>
<td><span class="api-param-type">${param.schema?.type || 'string'}</span></td>
<td>${param.description || '-'}</td>
<td>${descriptionHtml}</td>
<td>${required}</td>
</tr>
`;
@@ -297,11 +304,20 @@ function renderRequestBody(endpoint) {
typeDisplay += ` (${prop.enum.join(', ')})`;
}
// 处理描述文本,将换行符转换为<br>,但保持其他格式
let descriptionHtml = '-';
if (prop.description) {
// 转义HTML然后处理换行
const escapedDesc = escapeHtml(prop.description);
// 将 \n 转换为 <br>,但不要转换已经转义的换行
descriptionHtml = escapedDesc.replace(/\n/g, '<br>');
}
return `
<tr>
<td><span class="api-param-name">${escapeHtml(key)}</span></td>
<td><span class="api-param-type">${escapeHtml(typeDisplay)}</span></td>
<td>${prop.description ? escapeHtml(prop.description) : '-'}</td>
<td>${descriptionHtml}</td>
<td>${required}</td>
<td>${prop.example !== undefined ? `<code>${escapeHtml(String(prop.example))}</code>` : '-'}</td>
</tr>

View File

@@ -237,6 +237,25 @@
overflow-x: auto;
width: 100%;
-webkit-overflow-scrolling: touch;
margin-bottom: 16px;
}
/* 确保表格在移动设备上也能正常显示 */
@media (max-width: 768px) {
.api-params-table {
font-size: 0.8125rem;
}
.api-params-table th,
.api-params-table td {
padding: 8px;
}
/* 移动设备上描述列可以更宽 */
.api-params-table th:nth-child(3),
.api-params-table td:nth-child(3) {
min-width: 150px;
}
}
.api-section:last-child {
@@ -263,7 +282,7 @@
width: 100%;
border-collapse: collapse;
font-size: 0.875rem;
table-layout: auto;
table-layout: fixed;
}
.api-params-table th,
@@ -271,6 +290,38 @@
padding: 12px;
text-align: left;
border-bottom: 1px solid var(--border-color);
vertical-align: top;
}
/* 设置列宽 */
.api-params-table th:nth-child(1),
.api-params-table td:nth-child(1) {
width: 15%;
min-width: 120px;
}
.api-params-table th:nth-child(2),
.api-params-table td:nth-child(2) {
width: 12%;
min-width: 100px;
}
.api-params-table th:nth-child(3),
.api-params-table td:nth-child(3) {
width: 45%;
min-width: 200px;
}
.api-params-table th:nth-child(4),
.api-params-table td:nth-child(4) {
width: 10%;
min-width: 80px;
}
.api-params-table th:nth-child(5),
.api-params-table td:nth-child(5) {
width: 18%;
min-width: 150px;
}
/* 参数名、类型、必需、示例列不换行 */
@@ -283,23 +334,42 @@
.api-params-table th:nth-child(5),
.api-params-table td:nth-child(5) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 描述列允许换行 */
/* 描述列允许换行,但保持水平方向 */
.api-params-table th:nth-child(3),
.api-params-table td:nth-child(3) {
white-space: normal;
word-break: break-word;
word-wrap: break-word;
word-break: normal;
overflow-wrap: break-word;
writing-mode: horizontal-tb !important;
direction: ltr !important;
text-align: left;
line-height: 1.6;
max-width: none;
}
/* 确保描述单元格内的内容正常显示 */
.api-params-table td:nth-child(3) * {
display: inline;
writing-mode: horizontal-tb !important;
}
.api-params-table th {
background: var(--bg-secondary);
font-weight: 600;
color: var(--text-primary);
writing-mode: horizontal-tb !important;
direction: ltr !important;
}
.api-params-table td {
color: var(--text-secondary);
writing-mode: horizontal-tb !important;
direction: ltr !important;
}
.api-param-name {