jsdoc2md / jsdoc-to-markdown

Generate markdown documentation from jsdoc-annotated javascript
MIT License
1.68k stars 151 forks source link

Decorated classes get named "_class" in output .md file #281

Closed paulheg closed 2 years ago

paulheg commented 2 years ago

Hello there, in the process of trying to create markdown documentation for an angular / typescript project I am encountering the following issue:

Every class that is decorated with something like @Component, will be called "_class" in the output .md file.

How can I get the correct classname?

I am using the following jsdoc2md.json file:

{
    "source": {
      "includePattern": ".+\\.ts(doc|x)?$",
      "excludePattern": ".+\\.(test|spec).ts"
    },
    "plugins": [
      "plugins/markdown",
      "node_modules/jsdoc-babel"
    ],
    "babel": {
      "extensions": ["ts", "tsx"],
      "ignore": ["**/*.(test|spec).ts"],
      "babelrc": false,
      "presets": [
        ["@babel/preset-env", { "targets": { "node": true } }],
        "@babel/preset-typescript"
      ],
      "plugins": [
        ["@babel/plugin-proposal-decorators", { "legacy": true }],
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-proposal-object-rest-spread"
      ]
    }
  }
nicolas-tesla-x commented 2 years ago

I have the same problem, did you solve it?

paulheg commented 2 years ago

Unvortunately I couldnt fix it.

I moved on to transpile the typescript code to javascript and go from there using: tsc -p tsconfig.json &>/dev/null

You have to lookup the output dir in the tsconfig.json and pass it on to jsdoc2md.

I hope this helps.