Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Document all fields in docgen

Open beef331 opened this issue 3 years ago • 1 comments

Summary

Presently docgen does not document inherited fields or show fields of a ref or ptr object.

This means dom.Document looks like:

image

Which is very unhelpful if you're looking at what it exposes.

Description

The docgen should emit all the fields of any ref, ptr or object of as such the above should look like:

type Document = ref DocumentObj
    activeElement*: Element
    documentElement*: Element
    alinkColor*: cstring
    bgColor*: cstring
    body*: Element
    charset*: cstring
    cookie*: cstring
    defaultCharset*: cstring
    fgColor*: cstring
    head*: Element
    lastModified*: cstring
    linkColor*: cstring
    referrer*: cstring
    title*: cstring
    URL*: cstring
    vlinkColor*: cstring
    anchors*: seq[AnchorElement]
    forms*: seq[FormElement]
    images*: seq[ImageElement]
    applets*: seq[Element]
    embeds*: seq[EmbedElement]
    links*: seq[LinkElement]
    fonts*: FontFaceSet

In the case of an inheritance tree like the following:

type
  A* = object of RootObj
    someField: int
    someOtherField: string
  B* = object of A
    myField: int
  C* = object of B
    myOtherField: string 

The docgen should generate something a long the lines of the following. Yes this will make the docs longer but will provide more documentation and make life easier for people reading docs.

type
  A* = object of RootObj
    someField: int
    someOtherField: string
  B* = object of A
    myField: int
    # Inherited from `A`:(This should be a clickable link if possible)
    someField: int
    someOtherField: string
  C* = object of B
    myOtherField: string
    # Inherited from `B`:(Same)
    myField: int
    someField: int
    someOtherField: string

Alternatives

No response

Standard Output Examples

No response

Backwards Compatibility

No response

Links

No response

beef331 avatar Aug 23 '22 21:08 beef331

Apparently there is a command line option --showNonExports for this but it's only documented in a random code block

metagn avatar Dec 23 '23 18:12 metagn