Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better rendering for curried functions #714

Closed
TomerAberbach opened this issue Nov 6, 2024 · 5 comments
Closed

Better rendering for curried functions #714

TomerAberbach opened this issue Nov 6, 2024 · 5 comments
Labels
enhancement fixed Fix implemented in latest version.

Comments

@TomerAberbach
Copy link

What package is the feature request related to?

typedoc-plugin-markdown

Background

I'm using typedocs-plugin-markdown for a library of mine that has many curried functions, and unfortunately it currently generates overly verbose documentation for those functions.

For example, for this function: https://github.com/TomerAberbach/lfi/blob/fd6e1ff9d7b7d249090f89ead6d0a30e26aba2e4/src/operations/predicate.d.ts#L203-L223

I get these docs:
https://github.com/TomerAberbach/lfi/blob/fd6e1ff9d7b7d249090f89ead6d0a30e26aba2e4/docs/functions/includes.md

There are a couple of problems here:

  1. There is one documentation comment for all the overloads, but it's rendered multiple times
  2. One function is basically a "prefix" of the other so I would expect them to be merged somehow

Proposed solution

In terms of prior art, based on the screenshot in this comment, TypeStrong/typedoc#1421 (comment), it seems like the regular typedoc is able to handle this case with some sort of overload signature merging? Might be worth looking into what logic typedoc is doing there. I tried to figure it out, but couldn't nail down where it happens.

@tgreyuk
Copy link
Member

tgreyuk commented Nov 6, 2024

Thank you. Will take a look and try to align with the default theme as much as possible.

@TomerAberbach
Copy link
Author

Thank you!

@tgreyuk
Copy link
Member

tgreyuk commented Nov 27, 2024

@TomerAberbach [email protected] now correctly places the comments.

The output now correctly renders a single overall comment block above the overload signatures. Each overload has a "Call Signature" heading which easily divides the signatures when scanning the docs.

Markdown:

Screenshot 2024-11-27 at 20 46 53

HTML:

Screenshot 2024-11-27 at 20 46 29

Also output example can be seen here https://github.com/typedoc2md/typedoc-plugin-markdown-scratchpad/blob/main/issues/714/docs/md/functions/includes.md

Hope this is acceptable but let me know.

@tgreyuk tgreyuk added the fixed Fix implemented in latest version. label Nov 27, 2024
@TomerAberbach
Copy link
Author

It looks great, thank you so much! I just went ahead and published it to my new documentation site:

https://lfi.dev/docs/api/functions/includes

By the way, any reason you're not on GitHub sponsors? typedoc-plugin-markdown is amazing and I'd be happy to sponsor :)

@tgreyuk
Copy link
Member

tgreyuk commented Nov 29, 2024

No problem happy to help and thanks for feedback. I probably should get around to setting up a sponsor page :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement fixed Fix implemented in latest version.
Projects
None yet
Development

No branches or pull requests

2 participants