Fix checkRedirectTarget functionality
authorLanius Trolling <lanius@laniustrolling.dev>
Tue, 9 Apr 2024 16:33:37 +0000 (12:33 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Tue, 9 Apr 2024 16:33:37 +0000 (12:33 -0400)
src/jvmMain/kotlin/info/mechyrdia/lore/parser_html.kt

index 6c6252af267683b9351df2026a913c4d356e498e..614a0eeaaa505f34a16fb788aab563cefbfb922e 100644 (file)
@@ -296,7 +296,9 @@ class HtmlHeaderLexerTag(val tagCreator: TagCreator, val anchor: (ParserTree) ->
                        tagCreator {
                                +subNodes.treeToText()
                        }
-                       script { unsafe { +"window.checkRedirectTarget(\"${anchorId.orEmpty()}\");" } }
+                       
+                       val anchorHash = anchorId?.let { "#$it" }.orEmpty()
+                       script { unsafe { +"window.checkRedirectTarget(\"$anchorHash\");" } }
                }
        }
 }