microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.7k stars 130 forks source link

Is there a plugin API? #314

Open NathanPB opened 2 years ago

NathanPB commented 2 years ago

I want to add new @tags to make functionality that I need for my use case, is there any plugin API for developing extensions?

My particular use case, for better understanding

In my particular use case, I need something like this:

/**
 * This function does foo
 */
const fooBar = (a, b) => ...

/**
 * {@curry fooBar}
 */
const curriedFoobar = a => b => ...

Where @curry would generate exactly this template (below) and add a Curried tag in the generated HTML

/**
 * Curried version of {@link fooBar.
 * {@inheritDoc fooBar}
 */

image

Gerrit0 commented 2 years ago

Given that you are using TypeDoc, you'll need to write a TypeDoc plugin rather than a TSDoc plugin (which isn't a thing)

You could do this by listening to Converter.EVENT_CREATE_DECLARATION and modifying the comment.

zelliott commented 2 years ago

Note that you can define custom TSDoc tags in the tsdoc.json file (https://tsdoc.org/pages/packages/tsdoc-config/), if you're not already aware.