diff --git a/compiler/options.nim b/compiler/options.nim
index 42a907777..bf0a9a4ee 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -541,7 +541,7 @@ proc isDefined*(conf: ConfigRef; symbol: string): bool =
osDragonfly, osMacosx}
else: discard
-proc importantComments*(conf: ConfigRef): bool {.inline.} = conf.cmd notin cmdDocLike + {cmdIdeTools}
+proc importantComments*(conf: ConfigRef): bool {.inline.} = conf.cmd in cmdDocLike + {cmdIdeTools}
proc usesWriteBarrier*(conf: ConfigRef): bool {.inline.} = conf.selectedGC >= gcRefc
template compilationCachePresent*(conf: ConfigRef): untyped =
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html
index d9132d087..ee09b46af 100644
--- a/nimdoc/testproject/expected/testproject.html
+++ b/nimdoc/testproject/expected/testproject.html
@@ -120,7 +120,9 @@ function main() {
Vars
@@ -427,6 +429,13 @@ Some shapes.
+
+someVariable: bool
+-
+
+This should be visible.
+
+
aVariable: array[1, int]
-
diff --git a/nimdoc/testproject/expected/testproject.idx b/nimdoc/testproject/expected/testproject.idx
index 8d132acc4..5714efac0 100644
--- a/nimdoc/testproject/expected/testproject.idx
+++ b/nimdoc/testproject/expected/testproject.idx
@@ -1,3 +1,4 @@
+someVariable testproject.html#someVariable testproject: someVariable
C_A testproject.html#C_A testproject: C_A
C_B testproject.html#C_B testproject: C_B
C_C testproject.html#C_C testproject: C_C
diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html
index 34d24e900..03d9c72fe 100644
--- a/nimdoc/testproject/expected/theindex.html
+++ b/nimdoc/testproject/expected/theindex.html
@@ -244,6 +244,10 @@ function main() {
- utils: someType(): SomeType
+- someVariable:
- testNimDocTrailingExample:
- testproject: testNimDocTrailingExample()
diff --git a/nimdoc/testproject/testproject.nim b/nimdoc/testproject/testproject.nim
index 3cb7fddc5..eea399f82 100644
--- a/nimdoc/testproject/testproject.nim
+++ b/nimdoc/testproject/testproject.nim
@@ -9,6 +9,9 @@ runnableExamples:
# bug #11078
for x in "xx": discard
+
+var someVariable*: bool ## This should be visible.
+
when true:
## top2
runnableExamples: