Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/org/intellij/markdown/html/GeneratingProviders.kt
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ internal abstract class LinkGeneratingProvider(protected val baseURI: URI?) : Ge

protected fun makeAbsoluteUrl(destination : CharSequence) : CharSequence {
try {
if (destination.startsWith('#')) {
return destination
}
return baseURI?.resolve(destination.toString())?.toString() ?: destination
}
catch (e : IllegalArgumentException) {
Expand Down
2 changes: 2 additions & 0 deletions test/data/html/baseUriFile.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
+ [parent directory relative link definition]
+ [absolute link definition]
+ [root link definition]
+ [bookmark link definition]


[implicit current directory relative link definition]: baz.html
[explicit current directory relative link definition]: ./baz.html
[parent directory relative link definition]: ../quux.html
[absolute link definition]: https://google.com/
[root link definition]: /root
[bookmark link definition]: #abc
3 changes: 3 additions & 0 deletions test/data/html/baseUriFile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,8 @@
<li>
<a href="file:/root">root link definition</a>
</li>
<li>
<a href="#abc">bookmark link definition</a>
</li>
</ul>
</body>