Skip to content

Commit bc02096

Browse files
committed
feat: Allow excluding tags from comments
Closes #815
1 parent 429b3a9 commit bc02096

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/lib/converter/plugins/CommentPlugin.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Converter } from '../converter';
1515
import { Context } from '../context';
1616
import { partition, uniq } from 'lodash';
1717
import { SourceReference } from '../../models';
18+
import { BindOption } from '../../utils';
1819

1920
/**
2021
* These tags are not useful to display in the generated documentation.
@@ -64,6 +65,9 @@ interface ModuleComment {
6465
*/
6566
@Component({name: 'comment'})
6667
export class CommentPlugin extends ConverterComponent {
68+
@BindOption('excludeTags')
69+
excludeTags!: string[];
70+
6771
/**
6872
* List of discovered module comments.
6973
* Defined in this.onBegin
@@ -194,13 +198,13 @@ export class CommentPlugin extends ConverterComponent {
194198
if (reflection.kindOf(ReflectionKind.FunctionOrMethod) || (reflection.kindOf(ReflectionKind.Event) && reflection['signatures'])) {
195199
const comment = parseComment(rawComment, reflection.comment);
196200
this.applyModifiers(reflection, comment);
197-
this.removeBlacklistedTags(comment);
201+
this.removeExcludedTags(comment);
198202
} else if (reflection.kindOf(ReflectionKind.Module)) {
199203
this.storeModuleComment(rawComment, reflection);
200204
} else {
201205
const comment = parseComment(rawComment, reflection.comment);
202206
this.applyModifiers(reflection, comment);
203-
this.removeBlacklistedTags(comment);
207+
this.removeExcludedTags(comment);
204208
reflection.comment = comment;
205209
}
206210
}
@@ -327,10 +331,13 @@ export class CommentPlugin extends ConverterComponent {
327331
}
328332
}
329333

330-
private removeBlacklistedTags(comment: Comment) {
334+
private removeExcludedTags(comment: Comment) {
331335
for (const tag of TAG_BLACKLIST) {
332336
comment.removeTags(tag);
333337
}
338+
for (const tag of this.excludeTags) {
339+
comment.removeTags(tag);
340+
}
334341
}
335342

336343
/**

src/lib/utils/options/declaration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface TypeDocOptionMap {
6262
theme: string;
6363
name: string;
6464
includeVersion: boolean;
65+
excludeTags: string[];
6566
readme: string;
6667
defaultCategory: string;
6768
categoryOrder: string[];

src/lib/utils/options/sources/typedoc.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ export function addTypeDocOptions(options: Options) {
110110
});
111111
options.addDeclaration({
112112
name: 'includeVersion',
113-
help: 'Add the package version to the project name',
113+
help: 'Add the package version to the project name.',
114114
type: ParameterType.Boolean
115115
});
116+
options.addDeclaration({
117+
name: 'excludeTags',
118+
help: 'Remove the listed tags from doc comments.',
119+
type: ParameterType.Array
120+
});
116121
options.addDeclaration({
117122
name: 'readme',
118123
help: 'Path to the readme file that should be displayed on the index page. Pass `none` to disable the index page and start the documentation on the globals page.'

0 commit comments

Comments
 (0)