fix(frontend): 修复 Markdown 代码块折叠空白,收起滚回块顶
避免客户端覆盖 SSR 高亮;空行撑高;收起后 scrollIntoView 到代码块头部。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -17,6 +17,12 @@ export const prettyCodeOptions = {
|
||||
},
|
||||
keepBackground: false,
|
||||
defaultLang: "plaintext",
|
||||
// 空行在 display:grid 下会塌缩成 0 高,补一个空格撑住行高
|
||||
onVisitLine(element: { children: unknown[] }) {
|
||||
if (element.children.length === 0) {
|
||||
element.children = [{ type: "text", value: " " }];
|
||||
}
|
||||
},
|
||||
} as const;
|
||||
|
||||
/** 服务端异步管线:GFM + Shiki 双主题高亮 → React 树 */
|
||||
|
||||
Reference in New Issue
Block a user