Skip to content

Commit 787d37e

Browse files
Clarify nested showdoc
1 parent 30a7ccd commit 787d37e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/syntax_and_semantics/documenting_code.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Individual features can be explicitly excluded with `:nodoc:`, though.
237237
# :showdoc:
238238
#
239239
# This lib type and all features inside are part of the API docs.
240-
lib FooLib
240+
lib LibFoo
241241
# Documentation for bar
242242
fun bar : Void
243243
@@ -260,18 +260,27 @@ lib FooLib
260260
end
261261
```
262262

263-
If a parent namespace has the `:nodoc:` directive, any nested `:showdoc:` directive
263+
If a parent namespace is undocumented, any nested `:showdoc:` directive
264264
has no effect.
265265

266266
```crystal
267267
# :nodoc:
268268
struct MyStruct
269269
# :showdoc:
270270
#
271-
# This will not show up in API docs because the MyStruct namespace is nodoc.
271+
# This showdoc directive has no effect because the MyStruct namespace is nodoc.
272272
struct MyStructChild
273273
end
274274
end
275+
276+
# Implicitly nodoc
277+
lib LibFoo
278+
# :showdoc:
279+
#
280+
# This showdoc directive has no effect because the LibFoo namespace is implicitly undocumented.
281+
# If LibFoo had a showdoc directive, the showdoc directive here would be redundant.
282+
fun bar : Void
283+
end
275284
```
276285

277286
### `inherit`

0 commit comments

Comments
 (0)