Is it possible to generate a docs link based on NimSym? Or, even better, based 
on an argument's type?

Here comes an example: 
    
    
    # a.nim
    type Mock = object
    
    # b.nim
    import a
    
    macro add2docs(sym: typed, docs: string): typed =
      newCommentStmtNode(docs.format(XYZ(sym)))  # what XYZ should be?
    
    proc initMock(m: var Mock) =
      "$1 constructor".add2docs(Mock)
      ...
    
    # generates `Mock <http://nim-lang.org/docs/a.html#Mock>`_
    

Alternatively, I could get symbol's parent module (is it possible?) and 
generate the link manually based on that name. It wouldn't be as nice though, 
as it would make the link fixed to 
[http://nim-lang.org/docs](http://nim-lang.org/docs)/ (what if I want to have a 
local repo)?

Reply via email to