Hmm. That doesn't seem to solve this problem. The documentation generator is
running a full compile pass. So if I put code that is actually being used
behind a `when not defined(nimdoc)` clause, the doc generator fails to compile.
For example, trying to generate documentation for this:
when not defined(nimdoc):
proc internalOnly*() =
## A method that is "package private", but needs to be flagged as
## public so the rest of the module can access it. However, it
## should not show up in the documentation
echo "Hello"
proc publicApi*() =
## Public function that users can call
internalOnly()
publicApi()
Run
Yields the following error:
> nim doc example.nim
./example.nim(11, 5) Error: undeclared identifier: 'internalOnly'
candidates (edit distance, scope distance); see '--spellSuggest':
(3, 4): 'internalNew' [proc declared in
~/.choosenim/toolchains/nim-1.6.2/lib/system.nim(263, 6)]
./example.nim(11, 17) Error: attempting to call routine: 'internalOnly'
found 'internalOnly' [unknown declared in ./example.nim(11, 5)]
./example.nim(11, 17) Error: attempting to call routine: 'internalOnly'
found 'internalOnly' [unknown declared in ./example.nim(11, 5)]
./example.nim(11, 17) Error: expression 'internalOnly' cannot be called
Run