typedoc2md / typedoc-plugin-markdown

A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.
https://typedoc-plugin-markdown.org
MIT License
702 stars 176 forks source link

API.md missing functions #444

Closed RichiCoder1 closed 1 year ago

RichiCoder1 commented 1 year ago

Howdy! I'm using typedoc-plugin-markdown@next, and running into an issue where API.md only seems to contain exported interfaces and not functions. If I switch to outputFileStrategy: "modules" they show up, and the member MDs show up on disk with "members", but they don't show up in the API.md doc.

Is there a setting I need to flip to get exported function members into the API.md?

tgreyuk commented 1 year ago

Hello - I am trying to replicate this - is your code on a public repo? If not could you let me know what other options you are using? Many thanks.

RichiCoder1 commented 1 year ago

@tgreyuk private, but I'll see if I can put together a code sandbox with examples.

If it helps in the meantime:

.config/typedoc.cjs:

/** @type {import('typedoc').TypeDocOptions} */
module.exports = {
  name: "JS Libs",
  entryPointStrategy: "packages",
  out: "../docs",
  githubPages: false,
  gitRevision: "main",
  plugin: ["typedoc-plugin-markdown"],
  entryPoints: [
    "../packages/package-a"
  ],
  readme: "none"
};

.config/typedoc.base.json

{
  "$schema": "https://typedoc.org/schema.json",
  "includeVersion": true
}

packages/package-a/typedoc.config.json

{
  "$schema": "https://typedoc.org/schema.json",
  "extends": ["../../.config/typedoc.base.json"],
  "entryPoints": ["src/index.ts"]
}

packages/package-a/src/index.ts

export interface MyArgs {
  readonly someArg: boolean;
}

export function someExampleFunction(args: MyArgs) {
    return args;
}

Above is a adapted minisample. I think it's because in page.toc.ts it's only printing out modules:

https://github.com/tgreyuk/typedoc-plugin-markdown/blob/next/packages/typedoc-plugin-markdown/src/theme/resources/partials/page.toc.ts#L40-L41

But modules on includes (or seems to include exported interfaces in this case. So functions aren't present.

Is it intentional that the toc includes modules?

tgreyuk commented 1 year ago

Ok so there is obviously some weird going on but still not been able to replicate.

So I have put together an example repo for 'packages'. I'd be interested if you can see any differences in setup as the exports look correct. Please feel free to try and break it :)

This is API.md for a single package (as per your example):

https://github.com/tgreyuk/typedoc-plugin-markdown-examples/tree/main/monorepo/docs/single-package/API.md

Or for a typical setup with multiple packages:

https://github.com/tgreyuk/typedoc-plugin-markdown-examples/tree/main/monorepo/docs/multi-package/API.md

configs are here:

https://github.com/tgreyuk/typedoc-plugin-markdown-examples/tree/main/monorepo/.config