diff --git a/compiler/docgen.nim b/compiler/docgen.nim
index f2dec41b3..ffafb1fcb 100644
--- a/compiler/docgen.nim
+++ b/compiler/docgen.nim
@@ -642,6 +642,7 @@ proc getAllRunnableExamples(d: PDoc, n: PNode, dest: var Rope) =
var state = rsStart
template fn(n2) =
state = getAllRunnableExamplesImpl(d, n2, dest, state)
+ dest.add genComment(d, n).rope
case n.kind
of routineDefs:
n = n.getRoutineBody
diff --git a/lib/system/io.nim b/lib/system/io.nim
index 84bebba28..b1f6bb61b 100644
--- a/lib/system/io.nim
+++ b/lib/system/io.nim
@@ -501,11 +501,6 @@ proc readAll*(file: File): TaintedString {.tags: [ReadIOEffect], benign.} =
else:
result = readAllBuffer(file).TaintedString
-proc writeLn[Ty](f: File, x: varargs[Ty, `$`]) =
- for i in items(x):
- write(f, i)
- write(f, "\n")
-
proc writeLine*[Ty](f: File, x: varargs[Ty, `$`]) {.inline,
tags: [WriteIOEffect], benign.} =
## writes the values `x` to `f` and then writes "\\n".
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html
index b8d252cfb..4fd5d8ad3 100644
--- a/nimdoc/testproject/expected/testproject.html
+++ b/nimdoc/testproject/expected/testproject.html
@@ -190,6 +190,14 @@ function main() {
title="p1()">p1
addfBug14485
+ c_printf
+ c_nonexistant
+ low
+ low2
@@ -546,6 +554,46 @@ Some proc
7: end of broken html
]#
+
+
+proc c_printf(frmt: cstring): cint {...}{.importc: "printf", header: "<stdio.h>", varargs,
+ discardable.}
+
+
+the c printf. etc.
+
+
+
+proc c_nonexistant(frmt: cstring): cint {...}{.importc: "nonexistant", header: "<stdio.h>",
+ varargs, discardable.}
+
+
+
+
+
+
+proc low[T: Ordinal | enum | range](x: T): T {...}{.magic: "Low", noSideEffect.}
+
+
+Returns the lowest possible value of an ordinal value x. As a special semantic rule, x may also be a type identifier.
+See also:
+
+low(2)
+
+
+
+proc low2[T: Ordinal | enum | range](x: T): T {...}{.magic: "Low", noSideEffect.}
+
+
+Returns the lowest possible value of an ordinal value x. As a special semantic rule, x may also be a type identifier.
+See also:
+
+low2(2)
+Example:
+discard "in low2"
+
diff --git a/nimdoc/testproject/expected/testproject.idx b/nimdoc/testproject/expected/testproject.idx
index 447e9ff59..dd26c03d9 100644
--- a/nimdoc/testproject/expected/testproject.idx
+++ b/nimdoc/testproject/expected/testproject.idx
@@ -33,6 +33,10 @@ baz testproject.html#baz testproject: baz()
z17 testproject.html#z17 testproject: z17()
p1 testproject.html#p1 testproject: p1()
addfBug14485 testproject.html#addfBug14485 testproject: addfBug14485()
+c_printf testproject.html#c_printf,cstring testproject: c_printf(frmt: cstring): cint
+c_nonexistant testproject.html#c_nonexistant,cstring testproject: c_nonexistant(frmt: cstring): cint
+low testproject.html#low,T testproject: low[T: Ordinal | enum | range](x: T): T
+low2 testproject.html#low2,T testproject: low2[T: Ordinal | enum | range](x: T): T
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 3ecf7aab7..1e9e4374f 100644
--- a/nimdoc/testproject/expected/theindex.html
+++ b/nimdoc/testproject/expected/theindex.html
@@ -129,6 +129,14 @@ function main() {
testproject: C_D
+c_nonexistant:
+c_printf:
enumValueA:
+low:
+low2:
myfn:
- testproject: myfn()
diff --git a/nimdoc/testproject/testproject.nim b/nimdoc/testproject/testproject.nim
index 90b173403..45bbca223 100644
--- a/nimdoc/testproject/testproject.nim
+++ b/nimdoc/testproject/testproject.nim
@@ -177,6 +177,36 @@ when true: # issue #14485
7: end of broken html
]#
+when true: # procs without `=` (using comment field)
+ proc c_printf*(frmt: cstring): cint {.importc: "printf", header: "", varargs, discardable.}
+ ## the c printf.
+ ## etc.
+
+ proc c_nonexistant*(frmt: cstring): cint {.importc: "nonexistant", header: "", varargs, discardable.}
+
+when true: # tests RST inside comments
+ proc low*[T: Ordinal|enum|range](x: T): T {.magic: "Low", noSideEffect.}
+ ## Returns the lowest possible value of an ordinal value `x`. As a special
+ ## semantic rule, `x` may also be a type identifier.
+ ##
+ ## See also:
+ ## * `low2(T) <#low2,T>`_
+ ##
+ ## .. code-block:: Nim
+ ## low(2) # => -9223372036854775808
+
+ proc low2*[T: Ordinal|enum|range](x: T): T {.magic: "Low", noSideEffect.} =
+ ## Returns the lowest possible value of an ordinal value `x`. As a special
+ ## semantic rule, `x` may also be a type identifier.
+ ##
+ ## See also:
+ ## * `low(T) <#low,T>`_
+ ##
+ ## .. code-block:: Nim
+ ## low2(2) # => -9223372036854775808
+ runnableExamples:
+ discard "in low2"
+
when true: # (most) macros
macro bar*(): untyped =
result = newStmtList()