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

Export the default blockTags to allow extending them #2640

Closed
crycode-de opened this issue Jul 13, 2024 · 1 comment
Closed

Export the default blockTags to allow extending them #2640

crycode-de opened this issue Jul 13, 2024 · 1 comment
Labels
enhancement Improved functionality

Comments

@crycode-de
Copy link

Search Terms

Allow extending of the blockTags (and maybe inlineTags and others too) array.

Problem

Using blockTags config option it's already possible to overwrite the default blockTags definition. But extending them is currently not possible.

Of cause you could just copy&paste the default blockTags but it doesn't feel right and needs to be checked/updated on each TypeDoc update.

I'm using TypeDoc as node module by calling

import TypeDoc from 'typedoc';
const typeDocApp = await TypeDoc.Application.bootstrapWithPlugins({
  // ...
  blockTags: [
    // ...
  ],
});
//...

The I saw that the default blockTags are defined in:

export const blockTags = [
...tsdocBlockTags,
"@author",
"@callback",
"@category",
"@categoryDescription",
"@default",
"@document",
"@group",
"@groupDescription",
"@import",
"@inheritDoc",
"@jsx",
"@license",
"@module",
"@prop",
"@property",
"@return",
"@satisfies",
"@since",
"@template", // Alias for @typeParam
"@type",
"@typedef",
] as const;

Trying to import them directly from the dist path fails with ERR_PACKAGE_PATH_NOT_EXPORTED:

import { blockTags } from 'typedoc/dist/lib/utils/options/tsdoc-defaults.js';
// Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/lib/utils/options/tsdoc-defaults.js' is not defined by "exports" in /home/[...]/node_modules/typedoc/package.json imported from /home/[...]/scripts/docs.ts

Suggested Solution

Export the default blockTags (and maybe also the other default tags) to allow to import and extend them.

Example of possible use:

import TypeDoc from 'typedoc';
const typeDocApp = await TypeDoc.Application.bootstrapWithPlugins({
  // ...
  blockTags: [
    ...TypeDoc.defaults.blockTags,
    '@myCustomTag',
  ],
});
//...
@crycode-de crycode-de added the enhancement Improved functionality label Jul 13, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jul 13, 2024

Seems like a reasonable request 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

2 participants