Skip to content

Commit 4ebabb2

Browse files
committed
fix: remove unneeded code
1 parent 391a327 commit 4ebabb2

1 file changed

Lines changed: 1 addition & 18 deletions

File tree

server/utils/readme.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,6 @@ const isNpmJsUrlThatCanBeRedirected = (url: URL) => {
221221
return true
222222
}
223223

224-
const replaceHtmlLink = (html: string) => {
225-
return html.replace(/href="([^"]+)"/g, (match, href) => {
226-
if (isNpmJsUrlThatCanBeRedirected(new URL(href, 'https://www.npmjs.com'))) {
227-
const newHref = href.replace(/^https?:\/\/(www\.)?npmjs\.com/, '')
228-
return `href="${newHref}"`
229-
}
230-
return match
231-
})
232-
}
233-
234224
/**
235225
* Resolve a relative URL to an absolute URL.
236226
* If repository info is available, resolve to provider's raw file URLs.
@@ -437,14 +427,7 @@ ${html}
437427
return `<blockquote>${body}</blockquote>\n`
438428
}
439429

440-
marked.setOptions({
441-
renderer,
442-
walkTokens: token => {
443-
if (token.type === 'html') {
444-
token.text = replaceHtmlLink(token.text)
445-
}
446-
},
447-
})
430+
marked.setOptions({ renderer })
448431

449432
const rawHtml = marked.parse(content) as string
450433

0 commit comments

Comments
 (0)