Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Thanks @cyphercodes!

Captions now follow the global configuration for line spacing and letter spacing.

#### Fixed Quarkdoc `Wiki page` broken links if it contains anchors

The `@wiki` documentation tag now correctly preserves `#` anchor separators in wiki URLs.

## [1.15.0] - 2026-03-24

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.quarkdown.quarkdoc.dokka.page

import com.quarkdown.core.util.stripAnchor
import com.quarkdown.quarkdoc.dokka.util.findDeep
import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder
import org.jetbrains.dokka.model.DFunction
Expand Down Expand Up @@ -44,7 +45,16 @@ class WikiLinkPageTransformer(
documentable: DFunction,
builder: PageContentBuilder.DocumentableContentBuilder,
) = builder.buildGroup {
val url = WIKI_ROOT + URLEncoder.encode(data, Charsets.UTF_8)
val (page, anchor) = data.stripAnchor() ?: (data to null)
val url =
buildString {
append(WIKI_ROOT)
append(URLEncoder.encode(page, Charsets.UTF_8))
if (anchor != null) {
append('#')
append(URLEncoder.encode(anchor, Charsets.UTF_8))
}
}
link(data, url)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,20 @@ class WikiLinkTransformerTest : QuarkdocDokkaTest() {
assertContains(it, WIKI_ROOT + "home%3A+page")
}
}

@Test
fun `wiki with anchor`() {
test(
"""
/**
* @wiki File data#reading-files
*/
fun func() = Unit
""".trimIndent(),
"func",
) {
assertContains(it, "Wiki page")
assertContains(it, WIKI_ROOT + "File+data#reading-files")
}
}
}
Loading