rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[api-documenter] How to define custom tags behavior?

Open markus-incisive opened this issue 1 year ago • 5 comments

Summary

The tsdoc.json file allows adding custom tags. This allows them to be parsed, but how do I get them to be eventually emitted by api-documenter?

To be more specific, I want to add the inline @linkcode tag and have it behave exactly the same as the @link tag.

Repro steps

tsdoc.json:

{
  "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
  "tagDefinitions": [
    {
      "tagName": "@linkcode",
      "syntaxKind": "inline"
    }
  ]
}

Source code:

/**
 * This is a {@linkcode http://example.com/ | link}.
 *
 * @public
 */
export class MyClass {}

Actual result:

The documentation is created without any errors, but the custom @linkcode tag is simply ignored.

{9EE9877D-C12C-4F13-A349-6F2FA143C016}

Details

I noticed there's a seemingly undocumented api-documenter.json config file, but it mentions nothing of custom tags. If I need to create a plugin to add here, that's fine, but a how-to would be nice.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-documenter version? 7.25.14
Operating system? Windows
Documentation target? Markdown
Would you consider contributing a PR? No
TypeScript compiler version? 5.4.2
Node.js version (node -v)? 22.7.0

markus-incisive avatar Oct 01 '24 19:10 markus-incisive