惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
罗磊的独立博客
M
MIT News - Artificial intelligence
G
Google Developers Blog
V
V2EX
D
Docker
博客园_首页
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
WordPress大学
WordPress大学
T
Tailwind CSS Blog
博客园 - 司徒正美
J
Java Code Geeks
L
LangChain Blog
博客园 - 三生石上(FineUI控件)
B
Blog RSS Feed
博客园 - 【当耐特】
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - Franky

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(markdown): preserve loose list paragraphs (#74474) · ...
Lucenx9 · 2026-04-30 · via Recent Commits to openclaw:main

@@ -22,6 +22,8 @@ type MarkdownToken = {

2222

children?: MarkdownToken[];

2323

attrs?: [string, string][];

2424

attrGet?: (name: string) => string | null;

25+

hidden?: boolean;

26+

level?: number;

2527

};

26282729

export type MarkdownStyle =

@@ -262,16 +264,36 @@ function closeStyle(state: RenderState, style: MarkdownStyle) {

262264

}

263265

}

264266265-

function appendParagraphSeparator(state: RenderState) {

266-

if (state.env.listStack.length > 0) {

267-

return;

268-

}

267+

function appendParagraphSeparator(state: RenderState, token?: MarkdownToken) {

269268

if (state.table) {

270269

return;

271270

} // Don't add paragraph separators inside tables

271+

if (state.env.listStack.length > 0) {

272+

const directListParagraphLevel = state.env.listStack.length * 2;

273+

if (

274+

token?.type !== "paragraph_close" ||

275+

token.hidden ||

276+

token.level !== directListParagraphLevel

277+

) {

278+

return;

279+

}

280+

}

272281

state.text += "\n\n";

273282

}

274283284+

function appendTopLevelListSeparator(state: RenderState) {

285+

const trailingNewlines = state.text.match(/\n*$/)?.[0].length ?? 0;

286+

if (trailingNewlines < 2) {

287+

state.text += "\n";

288+

}

289+

}

290+291+

function appendNestedListSeparator(state: RenderState) {

292+

if (!state.text.endsWith("\n")) {

293+

state.text += "\n";

294+

}

295+

}

296+275297

function appendListPrefix(state: RenderState) {

276298

const stack = state.env.listStack;

277299

const top = stack[stack.length - 1];

@@ -636,7 +658,7 @@ function renderTokens(tokens: MarkdownToken[], state: RenderState): void {

636658

appendText(state, "\n");

637659

break;

638660

case "paragraph_close":

639-

appendParagraphSeparator(state);

661+

appendParagraphSeparator(state, token);

640662

break;

641663

case "heading_open":

642664

if (state.headingStyle === "bold") {

@@ -661,20 +683,20 @@ function renderTokens(tokens: MarkdownToken[], state: RenderState): void {

661683

case "bullet_list_open":

662684

// Add newline before nested list starts (so nested items appear on new line)

663685

if (state.env.listStack.length > 0) {

664-

state.text += "\n";

686+

appendNestedListSeparator(state);

665687

}

666688

state.env.listStack.push({ type: "bullet", index: 0 });

667689

break;

668690

case "bullet_list_close":

669691

state.env.listStack.pop();

670692

if (state.env.listStack.length === 0) {

671-

state.text += "\n";

693+

appendTopLevelListSeparator(state);

672694

}

673695

break;

674696

case "ordered_list_open": {

675697

// Add newline before nested list starts (so nested items appear on new line)

676698

if (state.env.listStack.length > 0) {

677-

state.text += "\n";

699+

appendNestedListSeparator(state);

678700

}

679701

const start = Number(getAttr(token, "start") ?? "1");

680702

state.env.listStack.push({ type: "ordered", index: start - 1 });

@@ -683,7 +705,7 @@ function renderTokens(tokens: MarkdownToken[], state: RenderState): void {

683705

case "ordered_list_close":

684706

state.env.listStack.pop();

685707

if (state.env.listStack.length === 0) {

686-

state.text += "\n";

708+

appendTopLevelListSeparator(state);

687709

}

688710

break;

689711

case "list_item_open":