diff --git a/src/main/kotlin/com/vandenbreemen/ktt/view/plugins/PageLinkPlugin.kt b/src/main/kotlin/com/vandenbreemen/ktt/view/plugins/PageLinkPlugin.kt index 5e0a964..7b3df69 100644 --- a/src/main/kotlin/com/vandenbreemen/ktt/view/plugins/PageLinkPlugin.kt +++ b/src/main/kotlin/com/vandenbreemen/ktt/view/plugins/PageLinkPlugin.kt @@ -11,7 +11,7 @@ class PageLinkPlugin(private val repository: SQLiteWikiRepository): PageRenderin val prefixChar = it.groupValues[1] repository.searchPageByTitle(linkText)?.let { existingPageId-> - return@replace "[$linkText](/page/$existingPageId)" + return@replace "$prefixChar[$linkText](/page/$existingPageId)" } "$prefixChar[$linkText](/page/create/$linkText)" diff --git a/src/test/kotlin/com/vandenbreemen/ktt/view/PageRenderingInteractorTest.kt b/src/test/kotlin/com/vandenbreemen/ktt/view/PageRenderingInteractorTest.kt index 2f6ee4e..83c704c 100644 --- a/src/test/kotlin/com/vandenbreemen/ktt/view/PageRenderingInteractorTest.kt +++ b/src/test/kotlin/com/vandenbreemen/ktt/view/PageRenderingInteractorTest.kt @@ -169,4 +169,22 @@ This test contains a link to a link that you can try out. rendered.shouldContain("
  • Test.Page") } + @Test + fun `should properly render bullet points with links for existing pages`() { + // Arrange + repository.createPage(Page("Test Page", "This is a test")) + val markdown = + """ +## Here is a Test +This test contains a link to a link that you can try out. +* [Test.Page] +""".trimIndent() + repository.createPage(Page("Test.Page", "This is a test")) + val rendered = pageRenderingInteractor.render(Page("test", markdown)) + + println(rendered) + + rendered.shouldContain("
  • Test.Page") + } + } \ No newline at end of file