Skip to content

Commit ba33ccb

Browse files
authored
Merge pull request #3426 from maseev/iss2466-contributing-link-fix
Fix rendering of the CONTRIBUTING page on Github
2 parents abd1e72 + 034eb5f commit ba33ccb

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed
File renamed without changes.

doc-tool/src/dotty/tools/dottydoc/staticsite/MarkdownLinkVisitor.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ package dottydoc
33
package staticsite
44

55
import com.vladsch.flexmark.ast._
6-
import com.vladsch.flexmark.util.sequence.CharSubSequence
7-
import model.{ Package, NonEntity, Val, Def, TypeAlias }
6+
import com.vladsch.flexmark.util.sequence.{BasedSequence, CharSubSequence}
7+
import model.{Def, NonEntity, Package, TypeAlias, Val}
88
import dottydoc.util.MemberLookup
99

1010
object MarkdownLinkVisitor {
1111
private val EntityLink = """([^\.]+)(\.[^\.]+)*""".r
1212
def apply(node: Node, docs: Map[String, Package], params: Map[String, AnyRef]): Unit =
13-
(new NodeVisitor(
13+
new NodeVisitor(
1414
new VisitHandler(classOf[Link], new Visitor[Link] with MemberLookup {
1515
override def visit(node: Link): Unit = {
16+
def isExternal(url: BasedSequence) =
17+
url.startsWith("http") || url.startsWith("https")
18+
1619
val url = node.getUrl
17-
if (url.endsWith(".md")) node.setUrl {
20+
if (url.endsWith(".md") && !isExternal(url)) node.setUrl {
1821
url.subSequence(0, url.lastIndexOf('.')).append(".html")
1922
}
2023
else if (EntityLink.unapplySeq(url.toString).isDefined) {
@@ -37,6 +40,6 @@ object MarkdownLinkVisitor {
3740
}
3841
}
3942
})
40-
))
43+
)
4144
.visit(node)
4245
}

docs/docs/contributing/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ $ sbt
7575
```
7676

7777
Before contributing to Dotty, we invite you to consult the
78-
[Dotty Developer Guidelines](https://github.com/lampepfl/dotty/blob/master/CONTRIBUTING).
78+
[Dotty Developer Guidelines](https://github.com/lampepfl/dotty/blob/master/CONTRIBUTING.md).

0 commit comments

Comments
 (0)