fix(markdown): trim blockquote separator spans · openclaw/openclaw@089d777
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -147,6 +147,7 @@ Docs: https://docs.openclaw.ai
|
147 | 147 | - OpenAI/Codex: install the Codex runtime plugin from npm during OpenAI onboarding and load it automatically for implicit OpenAI model routes, while preserving manual PI runtime overrides. Fixes #79358. |
148 | 148 | - OpenAI/realtime voice: defer `response.create` while a realtime response is still active, retry after `response.done`/`response.cancelled`, and align GA input transcription/noise-reduction defaults with the Codex realtime reference so Discord/Voice Call consult results can resume speaking instead of tripping the active-response race. |
149 | 149 | - Gateway: avoid false degraded event-loop health during rapid health/readiness/status probes unless sustained load has delay co-evidence, while keeping hard delay detection immediate. (#77028) Thanks @rubencu. |
| 150 | +- Markdown: keep blockquote spans off trailing paragraph separators. Fixes #79646. |
150 | 151 | - Codex app-server: keep native hook relays alive for long-running turns so shell and file approvals stay reachable until the configured run window finishes. (#77533) Thanks @rubencu. |
151 | 152 | - Gateway/agent: pass the session-key agent id into inline image attachment validation so the first image in a fresh per-agent session uses the agent's vision-capable model override instead of the text-only system default. Fixes #79407. Thanks @pandadev66. |
152 | 153 | - Gateway/maintenance: prune dedupe overflow against a stable excess count and keep active agent retries from starting duplicate runs after cache eviction. (#73841) Thanks @thesomewhatyou. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -46,6 +46,14 @@ describe("blockquote spacing", () => {
|
46 | 46 | |
47 | 47 | expect(result.text).not.toContain("\n\n\n"); |
48 | 48 | }); |
| 49 | + |
| 50 | +it("excludes the trailing paragraph separator from the blockquote span", () => { |
| 51 | +const result = markdownToIR("> `gpt`\n\nbody"); |
| 52 | + |
| 53 | +expect(result.text).toBe("gpt\n\nbody"); |
| 54 | +expect(result.styles).toContainEqual({ start: 0, end: 3, style: "blockquote" }); |
| 55 | +expect(result.styles).toContainEqual({ start: 0, end: 3, style: "code" }); |
| 56 | +}); |
49 | 57 | }); |
50 | 58 | |
51 | 59 | describe("consecutive blockquotes", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -250,13 +250,20 @@ function openStyle(state: RenderState, style: MarkdownStyle) {
|
250 | 250 | target.openStyles.push({ style, start: target.text.length }); |
251 | 251 | } |
252 | 252 | |
253 | | -function closeStyle(state: RenderState, style: MarkdownStyle) { |
| 253 | +function closeStyle( |
| 254 | +state: RenderState, |
| 255 | +style: MarkdownStyle, |
| 256 | +options?: { trimTrailingParagraphSeparator?: boolean }, |
| 257 | +) { |
254 | 258 | const target = resolveRenderTarget(state); |
255 | 259 | for (let i = target.openStyles.length - 1; i >= 0; i -= 1) { |
256 | 260 | if (target.openStyles[i]?.style === style) { |
257 | 261 | const start = target.openStyles[i].start; |
258 | 262 | target.openStyles.splice(i, 1); |
259 | | -const end = target.text.length; |
| 263 | +const end = |
| 264 | +options?.trimTrailingParagraphSeparator && target.text.endsWith("\n\n") |
| 265 | + ? target.text.length - 2 |
| 266 | + : target.text.length; |
260 | 267 | if (end > start) { |
261 | 268 | target.styles.push({ start, end, style }); |
262 | 269 | } |
@@ -680,7 +687,7 @@ function renderTokens(tokens: MarkdownToken[], state: RenderState): void {
|
680 | 687 | openStyle(state, "blockquote"); |
681 | 688 | break; |
682 | 689 | case "blockquote_close": |
683 | | -closeStyle(state, "blockquote"); |
| 690 | +closeStyle(state, "blockquote", { trimTrailingParagraphSeparator: true }); |
684 | 691 | break; |
685 | 692 | case "bullet_list_open": |
686 | 693 | // Add newline before nested list starts (so nested items appear on new line) |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。