We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 484a888 commit 0a3f4afCopy full SHA for 0a3f4af
1 file changed
server/utils/readme.ts
@@ -399,6 +399,14 @@ export async function renderReadmeHtml(
399
if (attribs.href && hasProtocol(attribs.href, { acceptRelative: true })) {
400
attribs.rel = 'nofollow noreferrer noopener'
401
attribs.target = '_blank'
402
+
403
+ // Replace npmjs.com|npmjs.org urls with npmx.dev
404
+ const npmjsMatch = attribs.href.match(
405
+ /^(?:https?:\/\/)?(?:www\.)?npmjs\.(?:com|org)\/(.+)/,
406
+ )
407
+ if (npmjsMatch) {
408
+ attribs.href = `https://npmx.dev/${npmjsMatch[1]}`
409
+ }
410
}
411
return { tagName, attribs }
412
},
0 commit comments