milesj / docusaurus-plugin-typedoc-api

Docusaurus plugin that provides source code API documentation powered by TypeDoc.
69 stars 25 forks source link

[Question] Support for a "Reference" section. #153

Closed rash805115 closed 1 week ago

rash805115 commented 1 month ago

In my class doc, I want to show a new section called "References" which should be able to show a list of classes I want to reference.

The UI would look similar to what you see today in the Index section, but with a new heading References.

Screenshot 2024-08-03 at 10 29 25 PM

I feel a functionality like this would come in handy for projects like mine where I want to show "This class A can be called by Class B and Class C". In class B file, you will be able to reference class A as well.

TypeDoc does not support any such tags. So I was thinking of supporting a custom tag in this library, called - @reference. E.g.

/**
This is class A and does blah.

@reference {@link B}
@reference {@link C}
*/
class A {
  ...
}

To make this work, the users would have to create a new tsdoc.json file in the root of their directory.

{
    "$schema": "https://developer.microsoft.com/en-us/json-schemas/tsdoc/v0/tsdoc.schema.json",
    "extends": ["typedoc/tsdoc.json"],
    "noStandardTags": false,
    "tagDefinitions": [
        {
            "tagName": "@reference",
            "syntaxKind": "block",
            "allowMultiple": true
        }
    ]
}

In the code, we should be able to

I have a semi-working POC that I can make a PR with. Do you think this would be helpful to support in this library?

rash805115 commented 1 month ago

@milesj I have created a PR: https://github.com/milesj/docusaurus-plugin-typedoc-api/pull/154 in case you decide to accept this. Thanks again :)