Skip to content

Commit c0708db

Browse files
committed
Fix external links
1 parent 8d6101d commit c0708db

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

internal/documentation/jsdoc/docdash/publish.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@ function linkTo(longname, linkText, cssClass, fragmentId) {
604604
if (hasUrlPrefix) {
605605
fileUrl = stripped;
606606
text = linkText || stripped;
607+
// Add target and rel attributes for external links
608+
return util.format('<a href="%s"%s target="_blank" rel="noopener noreferrer">%s</a>',
609+
encodeURI(fileUrl + fragmentString), classString, text);
607610
}
608611
// handle complex type expressions that may require multiple links
609612
// (but skip anything that looks like an inline tag or HTML tag)
@@ -629,6 +632,9 @@ function linkTo(longname, linkText, cssClass, fragmentId) {
629632
// Convert source file links to GitHub URLs if configured
630633
if (fileUrl && githubSourceBaseUrl && (fileUrl.endsWith('.js.md') || longname.endsWith('.js'))) {
631634
fileUrl = convertSourceLinkToGitHub(fileUrl, longname);
635+
// GitHub links should open in new tab
636+
return util.format('<a href="%s"%s target="_blank" rel="noopener noreferrer">%s</a>',
637+
encodeURI(fileUrl + fragmentString), classString, text);
632638
}
633639
// Remove .md extension from internal links for VitePress compatibility
634640
// Handle both cases: with and without fragment identifiers

internal/documentation/jsdoc/docdash/tmpl/details.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (data.defaultvalue && (data.defaultvaluetype === 'object' || data.defaultvalu
2020
<?js } ?>
2121

2222
<?js if (data.meta && self.outputSourceFiles) {?>
23-
**Source:** <?js= self.linkto(meta.shortpath) ?>, <?js= self.linkto(meta.shortpath, 'line ' + meta.lineno, null, 'line' + meta.lineno) ?>
23+
**Source:** <?js= self.linkto(meta.shortpath) ?>, <?js= self.linkto(meta.shortpath, 'line ' + meta.lineno, null, 'L' + meta.lineno) ?>
2424

2525
<?js } ?>
2626

0 commit comments

Comments
 (0)