From 902fa0767a1290973971923726d765b82133bfb5 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 12 Jan 2026 13:55:33 -0800 Subject: [PATCH] shelley/ui/src/utils: exclude * in auto-linkify Fixes boldsoftware/shelley#12 --- ui/src/utils/linkify.test.ts | 9 +++++++++ ui/src/utils/linkify.tsx | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/src/utils/linkify.test.ts b/ui/src/utils/linkify.test.ts index 0c88381cc1d12b117c1959ec6dde2fa4f19f8d7f..cfe9559da356f2fc550dee5364cef73e13dd6710 100644 --- a/ui/src/utils/linkify.test.ts +++ b/ui/src/utils/linkify.test.ts @@ -233,6 +233,15 @@ const testCases: TestCase[] = [ { type: "text", content: "> for more" }, ], }, + { + name: "URL in markdown bold - should not include asterisks", + input: "Download here: **https://example.com/file.vsix**", + expected: [ + { type: "text", content: "Download here: **" }, + { type: "link", content: "https://example.com/file.vsix", href: "https://example.com/file.vsix" }, + { type: "text", content: "**" }, + ], + }, ]; function deepEqual(a: unknown, b: unknown): boolean { diff --git a/ui/src/utils/linkify.tsx b/ui/src/utils/linkify.tsx index e320f75192554f6a47e8ed82fe0a79c9ce1e13a0..5ea73f0baf0932660b9aed748e9f5b9435970ac9 100644 --- a/ui/src/utils/linkify.tsx +++ b/ui/src/utils/linkify.tsx @@ -3,7 +3,7 @@ import React from "react"; // Regex for matching URLs. Only matches http:// and https:// URLs. // Avoids matching trailing punctuation that's likely not part of the URL. // eslint-disable-next-line no-useless-escape -const URL_REGEX = /https?:\/\/[^\s<>"'`\]\)]+[^\s<>"'`\]\).,:;!?]/g; +const URL_REGEX = /https?:\/\/[^\s<>"'`\]\)*]+[^\s<>"'`\]\).,:;!?*]/g; export interface LinkifyResult { type: "text" | "link";