diff --git a/compiler/renderverbatim.nim b/compiler/renderverbatim.nim
index a784331635..974454456b 100644
--- a/compiler/renderverbatim.nim
+++ b/compiler/renderverbatim.nim
@@ -66,10 +66,9 @@ proc renderNimCode*(result: var string, code: string, isLatex = false) =
buf.addEscaped(val)
let class = tokenClassToStr[kind]
if isLatex:
- result.addf "\\span$1{$2}" % [class, buf]
+ result.addf "\\span$1{$2}", [class, buf]
else:
- result.addf "$2" % [class, buf]
-
+ result.addf "$2", [class, buf]
while true:
getNextToken(toknizr, langNim)
case toknizr.kind
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html
index 420b609242..b8d252cfbb 100644
--- a/nimdoc/testproject/expected/testproject.html
+++ b/nimdoc/testproject/expected/testproject.html
@@ -188,6 +188,8 @@ function main() {
title="z17()">z17
p1
+ addfBug14485
@@ -525,6 +527,25 @@ this is a nested doc comment
discard "c9"
+
+
+proc addfBug14485() {...}{.raises: [], tags: [].}
+
+
+Some proc
+Example:
+discard "foo() = " & $[1]
+
+
diff --git a/nimdoc/testproject/expected/testproject.idx b/nimdoc/testproject/expected/testproject.idx
index 76193de87d..447e9ff597 100644
--- a/nimdoc/testproject/expected/testproject.idx
+++ b/nimdoc/testproject/expected/testproject.idx
@@ -32,6 +32,7 @@ z13 testproject.html#z13 testproject: z13()
baz testproject.html#baz testproject: baz()
z17 testproject.html#z17 testproject: z17()
p1 testproject.html#p1 testproject: p1()
+addfBug14485 testproject.html#addfBug14485 testproject: addfBug14485()
bar testproject.html#bar.m testproject: bar(): untyped
z16 testproject.html#z16.m testproject: z16()
z18 testproject.html#z18.m testproject: z18(): int
diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html
index df118d8a67..3ecf7aab70 100644
--- a/nimdoc/testproject/expected/theindex.html
+++ b/nimdoc/testproject/expected/theindex.html
@@ -77,6 +77,10 @@ function main() {
testproject: A
+addfBug14485:
aEnum:
- utils: aEnum(): untyped
diff --git a/nimdoc/testproject/testproject.nim b/nimdoc/testproject/testproject.nim
index 39bbe3dc5b..90b173403a 100644
--- a/nimdoc/testproject/testproject.nim
+++ b/nimdoc/testproject/testproject.nim
@@ -161,6 +161,22 @@ when true: # capture non-doc comments correctly even before 1st token
# also work after
# this should be out
+when true: # issue #14485
+ proc addfBug14485*() =
+ ## Some proc
+ runnableExamples:
+ discard "foo() = " & $[1]
+ #[
+ 0: let's also add some broken html to make sure this won't break in future
+ 1:
+ 2:
+ 3:
+ 5: