Skip to content

Commit 6798836

Browse files
committed
Update MarkdownBlock.tsx
1 parent 347a292 commit 6798836

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

webview-ui/src/components/common/MarkdownBlock.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,19 @@ const remarkUrlToLink = () => {
3434

3535
const parts = node.value.split(urlRegex)
3636
const children: any[] = []
37+
const cleanedMatches = matches.map((url: string) => url.replace(/[.,;:!?'"]+$/, ""))
3738

3839
parts.forEach((part: string, i: number) => {
3940
if (part) {
4041
children.push({ type: "text", value: part })
4142
}
4243

43-
if (matches[i]) {
44-
children.push({ type: "link", url: matches[i], children: [{ type: "text", value: matches[i] }] })
44+
if (cleanedMatches[i]) {
45+
children.push({
46+
type: "link",
47+
url: cleanedMatches[i],
48+
children: [{ type: "text", value: cleanedMatches[i] }],
49+
})
4550
}
4651
})
4752

0 commit comments

Comments
 (0)