Skip to content

Commit 357c287

Browse files
Widen scope of "linkified" PR/issue hashes in bodies
1 parent e003944 commit 357c287

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/routes/+page.svelte

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,16 @@
547547
})()}
548548
{@const releaseBody = (() => {
549549
const body = release.body ?? "";
550-
if (releaseRepo?.repoName !== "language-tools") return body;
550+
if (!releaseRepo) return body;
551551
// Add missing links to PRs in the release body
552552
return body.replace(
553-
/\(#(\d+)\)/g, // Match all `(#1234)` patterns
554-
(_, prNumber) => {
555-
const prUrl = `https://github.com/sveltejs/${releaseRepo.repoName}/pull/${prNumber}`;
556-
return `([#${prNumber}](${prUrl}))`;
553+
/[^[][#\d, ]*?#(\d+)(#issuecomment-\d+)?[#\d, ]*?[^\]]/g,
554+
// Match all `(#1234)` patterns, including `#issuecomment-` ones and multiple in one parenthesis
555+
(match, prNumber, rest) => {
556+
if (!rest) rest = "";
557+
const prUrl = `https://github.com/sveltejs/${releaseRepo.repoName}/pull/${prNumber}${rest}`;
558+
// replaceception
559+
return match.replace(`#${prNumber}${rest}`, `[#${prNumber}${rest}](${prUrl})`);
557560
}
558561
);
559562
})()}

0 commit comments

Comments
 (0)