优化帖子详情与列表展示,并新增问答帖类型与已解决状态。

统一标题锚点定位、编辑底栏固定与操作栏分层,列表徽章前置并区分置顶/问答配色。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-04 00:19:32 +08:00
parent 3aca5c42c5
commit b24f6c23ea
16 changed files with 696 additions and 239 deletions

View File

@@ -132,10 +132,22 @@ export function renderPostContentHtml(
enhanceHeadingAnchors(doc.body);
enhanceCodeBlocks(doc.body);
wrapContentTables(doc.body);
return doc.body.innerHTML;
}
/** 表格外包一层,避免 display:block 时边框撑满而单元格背景偏窄 */
function wrapContentTables(root: ParentNode): void {
root.querySelectorAll('table').forEach(table => {
if (table.parentElement?.classList.contains('md-table-wrap')) return;
const wrap = table.ownerDocument.createElement('div');
wrap.className = 'md-table-wrap';
table.replaceWith(wrap);
wrap.appendChild(table);
});
}
function isFloatDisplayImage(el: Element): boolean {
if (el.tagName !== 'IMG') return false;
const display = el.getAttribute('data-display') || '';