File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -368,6 +368,12 @@ ${html}
368368 const isExternal = resolvedHref . startsWith ( 'http://' ) || resolvedHref . startsWith ( 'https://' )
369369 const relAttr = isExternal ? ' rel="nofollow noreferrer noopener"' : ''
370370 const targetAttr = isExternal ? ' target="_blank"' : ''
371+ const isExternalIcon = isExternal
372+ ? `<span
373+ class="i-carbon:launch inline-block rtl-flip ms-1 size-[1em] opacity-50"
374+ aria-hidden="true"
375+ />`
376+ : ''
371377
372378 // Check if this is a playground link
373379 const provider = matchPlaygroundProvider ( resolvedHref )
@@ -387,7 +393,7 @@ ${html}
387393
388394 const hrefValue = resolvedHref . startsWith ( '#' ) ? resolvedHref . toLowerCase ( ) : resolvedHref
389395
390- return `<a href="${ hrefValue } "${ titleAttr } ${ relAttr } ${ targetAttr } >${ text } </a>`
396+ return `<a href="${ hrefValue } "${ titleAttr } ${ relAttr } ${ targetAttr } >${ text } ${ isExternalIcon } </a>`
391397 }
392398
393399 // GitHub-style callouts: > [!NOTE], > [!TIP], etc.
Original file line number Diff line number Diff line change @@ -323,7 +323,7 @@ describe('Markdown Content Extraction', () => {
323323 const result = await renderReadmeHtml ( markdown , 'test-pkg' )
324324
325325 expect ( result . html ) . toBe ( `<h3 id="user-content-title" data-level="1">Title</h3>
326- <p>Some <strong>bold</strong> text and a <a href="https://example.com" rel="nofollow noreferrer noopener" target="_blank">link</a>.</p>
326+ <p>Some <strong>bold</strong> text and a <a href="https://example.com" rel="nofollow noreferrer noopener" target="_blank">link<span class="i-carbon:launch inline-block rtl-flip ms-1 size-[1em] opacity-50"></span>< /a>.</p>
327327` )
328328 } )
329329 } )
You can’t perform that action at this time.
0 commit comments