I'm starting to touch on creating more complex structures with macros, and I have a few open questions. The first of which is:
How does the compiler deal with generating documentation for procs, enums and objects that were themselves created by macros?
If I remember correctly the difference between generating docs with either nim doc <source> or nim doc2 <source> is that the latter includes stuff from macros. A quick check seems to confirm this:
import macros
macro test(): untyped =
let testproc = quote do:
proc someProc*(param1: int) =
## Documentation here
echo "test"
echo testproc.treerepr
result = testproc
test()
Note that the macros module documentation mentions that the content of comments is not yet part of the AST (it appears as a nnkCommentStmt as the very first element of the body). But apparently that is not an issue, because it can be created from quote (or a template + getAst probably).