jsdoc2md / jsdoc-to-markdown

Generate markdown documentation from jsdoc-annotated javascript
MIT License
1.69k stars 152 forks source link

How do I document dynamic generated methods? Is name tag supported? #225

Closed DigitalBrainJS closed 2 months ago

DigitalBrainJS commented 4 years ago

I'm trying to document a dynamic generated method, so I use name tag for this, but it doesn't generate any namepaths/documentation.

class Animal{
    /**
     * Creates a new animal instance
     */
    constructor() {
    }

    /**
     * foo method
     */
    foo(){}

    /**
     * @name Animal#bar
     * @function
     * @memberof Animal
     * @description test
     * @param {number} x
     * @returns {boolean}
     */
}

jsdoc2md --namepaths index.js

{
  "module": [],
  "class": [
    "Animal"
  ],
  "constructor": [
    "Animal"
  ],
  "mixin": [],
  "member": [],
  "namespace": [],
  "constant": [],
  "function": [
    "Animal#foo" // Animal#bar is missing
  ],
  "event": [],
  "typedef": [],
  "external": []
}

But my IDE recognizes the method correctly: image

75lb commented 3 years ago

Hi, does this work as expected when generating docs directly using jsdoc?

75lb commented 3 years ago

Also, make sure you have a @module defined at the top: read this