Skip to content

Commit 36cb573

Browse files
authored
Merge pull request #73 from Two-Weeks-Team/feat/blockquote-hud
feat: wrap HUD output in markdown blockquote for dim styling
2 parents 897bbc0 + 088405a commit 36cb573

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/plugin.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,12 @@ const ANSI_RE = /\x1b\[[0-9;]*m/g
531531
export function appendUsageLineToOutputText(text: string, usageLine: string): string {
532532
const plain = usageLine.replace(ANSI_RE, "")
533533
const base = text.replace(HUD_STRIP_RE, "").trimEnd()
534+
const quoted = `> ${plain}`
534535
if (base.length === 0) {
535-
return plain
536+
return quoted
536537
}
537538

538-
return `${base}\n\n${plain}`
539+
return `${base}\n\n${quoted}`
539540
}
540541

541542
export function createHudPluginHooks(

tests/build-usage-line.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,12 @@ describe("appendUsageLineToOutputText strip-and-replace", () => {
454454

455455
it("appends after double newline", () => {
456456
const result = appendUsageLineToOutputText("Hello world", hudLine)
457-
expect(result).toBe(`Hello world\n\n${hudLine}`)
457+
expect(result).toBe(`Hello world\n\n> ${hudLine}`)
458458
})
459459

460460
it("returns plain line alone when text is empty", () => {
461461
const result = appendUsageLineToOutputText("", hudLine)
462-
expect(result).toBe(hudLine)
462+
expect(result).toBe(`> ${hudLine}`)
463463
})
464464

465465
it("strips existing HUD before appending new one", () => {
@@ -469,7 +469,7 @@ describe("appendUsageLineToOutputText strip-and-replace", () => {
469469
const second = appendUsageLineToOutputText(first, newHud)
470470
expect(second).not.toContain("10K/200K")
471471
expect(second).toContain("20K/200K")
472-
expect(second).toBe(`Hello\n\n${newHud}`)
472+
expect(second).toBe(`Hello\n\n> ${newHud}`)
473473
})
474474

475475
it("does not strip non-HUD text", () => {

0 commit comments

Comments
 (0)