Skip to content

Commit c417db0

Browse files
authored
Set target="_blank" for Source links in Scaladoc (#16282)
Context: - erikerlandson/coulomb#368 This seems to be necessary so that the source links work with javadoc.io. Note that Scaladoc 2 sets `target="_blank"`.
1 parent 87596cd commit c417db0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext
7272

7373
def source(m: Member): Seq[AppliedTag] =
7474
summon[DocContext].sourceLinks.pathTo(m).fold(Nil){ link =>
75-
tableRow("Source", a(href := link)(m.sources.fold("(source)")(_.path.getFileName().toString())))
75+
tableRow("Source", a(href := link, target := "_blank")(m.sources.fold("(source)")(_.path.getFileName().toString())))
7676
}
7777

7878
def deprecation(m: Member): Seq[AppliedTag] = m.deprecated.fold(Nil){ a =>

scaladoc/src/dotty/tools/scaladoc/util/html.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ object HTML:
108108
val onclick=Attr("onclick")
109109
val titleAttr =Attr("title")
110110
val onkeyup = Attr("onkeyup")
111+
val target = Attr("target")
111112

112113
def raw(content: String): AppliedTag = new AppliedTag(content)
113114
def raw(content: StringBuilder): AppliedTag = content

0 commit comments

Comments
 (0)