Skip to content

Commit

Permalink
tree -> blob in links to github
Browse files Browse the repository at this point in the history
  • Loading branch information
jillesvangurp committed Mar 13, 2024
1 parent 867fa49 commit 3d4565a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ mdCodeBlock(

This README.md is of course created from kotlin code that
runs as part of the test suite. You can look at the kotlin
source code that generates this markdown [here](https://github.com/jillesvangurp/kotlin4example/tree/master/src/test/kotlin/com/jillesvangurp/kotlin4example/docs/readme.kt).
source code that generates this markdown [here](https://github.com/jillesvangurp/kotlin4example/blob/master/src/test/kotlin/com/jillesvangurp/kotlin4example/docs/readme.kt).

The code that writes the `README.md file` is as follows:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Kotlin4Example(
val fn = this.sourceFileOfCaller()
val path = sourceRepository.sourcePaths.map { File(it, fn) }.firstOrNull { it.exists() }?.path
?: throw IllegalStateException("file not found")
return mdLink(title, "${sourceRepository.repoUrl}/tree/${sourceRepository.branch}/${path}")
return mdLink(title, "${sourceRepository.repoUrl}/blob/${sourceRepository.branch}/${path}")
}

@Deprecated("Use exampleFromSnippet", ReplaceWith("exampleFromSnippet(clazz, snippetId, allowLongLines, wrap, lineLength, type)"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ data class SourceRepository(
/**
* Construct a url to a given path in your repository.
*/
fun urlForFile(path: String) = "${repoUrl}/tree/${branch}/$path"
fun urlForFile(path: String) = "${repoUrl}/blob/${branch}/$path"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class KotlinForExampleTest {

@Test
fun `link to self should be correct`() {
testDocOutsideClass shouldContain "https://github.com/jillesvangurp/kotlin4example/tree/master/src/test/kotlin/com/jillesvangurp/kotlin4example/KotlinForExampleTest.kt"
testDocOutsideClass shouldContain "https://github.com/jillesvangurp/kotlin4example/blob/master/src/test/kotlin/com/jillesvangurp/kotlin4example/KotlinForExampleTest.kt"
}

@Test
Expand Down

0 comments on commit 3d4565a

Please sign in to comment.