From c34ddb5f26067120a7ed6fffa1691395d384478c Mon Sep 17 00:00:00 2001 From: "Dr. Armando Vaquera (proyectoauraorg)" Date: Thu, 21 May 2026 09:51:31 -0600 Subject: [PATCH] fix(markdown): don't strikethrough text wrapped in a single tilde (#154) remark-gfm treats a single ~ around text (e.g. "~10", "1~3") as strikethrough, unlike VS Code's markdown. Pass { singleTilde: false } so only "~~text~~" renders as strikethrough. Co-Authored-By: Claude Opus 4.7 --- .../src/components/common/MarkdownBlock.tsx | 4 +++- .../common/__tests__/MarkdownBlock.spec.tsx | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/components/common/MarkdownBlock.tsx b/webview-ui/src/components/common/MarkdownBlock.tsx index 47c61a5ce0..2553a5e558 100644 --- a/webview-ui/src/components/common/MarkdownBlock.tsx +++ b/webview-ui/src/components/common/MarkdownBlock.tsx @@ -307,7 +307,9 @@ const MarkdownBlock = memo(({ markdown }: MarkdownBlockProps) => { { return (tree: any) => { diff --git a/webview-ui/src/components/common/__tests__/MarkdownBlock.spec.tsx b/webview-ui/src/components/common/__tests__/MarkdownBlock.spec.tsx index 8e41eefa14..7b1183684b 100644 --- a/webview-ui/src/components/common/__tests__/MarkdownBlock.spec.tsx +++ b/webview-ui/src/components/common/__tests__/MarkdownBlock.spec.tsx @@ -36,6 +36,30 @@ describe("MarkdownBlock", () => { expect(paragraph?.textContent).toBe("Check out this link: https://example.com.") }, 10000) + it("should not strikethrough text wrapped in a single tilde (#154)", async () => { + const markdown = "1. Lorem ~10 ipsum dolor sit 1~3 amet." + const { container } = render() + + await screen.findByText(/Lorem/, { exact: false }) + + // Single tildes around numbers must NOT become strikethrough. + expect(container.querySelectorAll("del").length).toBe(0) + const listItem = container.querySelector("li") + expect(listItem?.textContent).toContain("~10") + expect(listItem?.textContent).toContain("1~3") + }, 10000) + + it("should still strikethrough text wrapped in double tildes", async () => { + const markdown = "This is ~~struck~~ text." + const { container } = render() + + await screen.findByText(/struck/, { exact: false }) + + const del = container.querySelector("del") + expect(del).not.toBeNull() + expect(del?.textContent).toBe("struck") + }, 10000) + it("should render unordered lists with proper styling", async () => { const markdown = `Here are some items: - First item