Skip to content

Commit 30d0204

Browse files
authored
feat: custom tags for resolver (#37)
1 parent 1141240 commit 30d0204

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

api-docs-gen-api.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ Resolve the markdown content reference
482482

483483
**Signature:**
484484
```typescript
485-
export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage): string;
485+
export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage, customTags?: string[]): string;
486486
```
487487

488488
#### Parameters
@@ -493,6 +493,7 @@ export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiM
493493
| item | ApiItem | a [item](https://rushstack.io/pages/api/api-extractor-model.apiitem/) |
494494
| model | ApiModel | a [model](https://rushstack.io/pages/api/api-extractor-model.apimodel/) |
495495
| pkg | ApiPackage | a [package](https://rushstack.io/pages/api/api-extractor-model.apipackage/) |
496+
| customTags | string\[\] | TSDoc custom tags. This parameter is set to an array of custom tag names defined in `--tsdoc-config`. |
496497

497498
#### Returns
498499

@@ -535,7 +536,7 @@ Resolve the markdown content reference
535536

536537
**Signature:**
537538
```typescript
538-
export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage): string;
539+
export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage, customTags?: string[]): string;
539540
```
540541

541542
#### Parameters
@@ -546,6 +547,7 @@ export declare function resolve(style: GenerateStyle, item: ApiItem, model: ApiM
546547
| item | ApiItem | a [item](https://rushstack.io/pages/api/api-extractor-model.apiitem/) |
547548
| model | ApiModel | a [model](https://rushstack.io/pages/api/api-extractor-model.apimodel/) |
548549
| pkg | ApiPackage | a [package](https://rushstack.io/pages/api/api-extractor-model.apipackage/) |
550+
| customTags | string\[\] | TSDoc custom tags. This parameter is set to an array of custom tag names defined in `--tsdoc-config`. |
549551

550552
#### Returns
551553

@@ -612,7 +614,7 @@ Markdown reference resolver
612614

613615
**Signature:**
614616
```typescript
615-
export declare type ReferenceResolver = (style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage) => string;
617+
export declare type ReferenceResolver = (style: GenerateStyle, item: ApiItem, model: ApiModel, pkg: ApiPackage, customTags?: string[]) => string;
616618
```
617619

618620

src/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export interface Config {
3434
* @param item - a {@link https://rushstack.io/pages/api/api-extractor-model.apiitem/ | item}
3535
* @param model - a {@link https://rushstack.io/pages/api/api-extractor-model.apimodel/ | model}
3636
* @param pkg - a {@link https://rushstack.io/pages/api/api-extractor-model.apipackage/ | package}
37+
* @param customTags - TSDoc custom tags. This parameter is set to an array of custom tag names defined in `--tsdoc-config`.
3738
*
3839
* @returns resolved reference path
3940
*
@@ -43,7 +44,8 @@ export type ReferenceResolver = (
4344
style: GenerateStyle,
4445
item: ApiItem,
4546
model: ApiModel,
46-
pkg: ApiPackage
47+
pkg: ApiPackage,
48+
customTags?: string[]
4749
) => string
4850

4951
/**

src/processor/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,8 @@ export function getDocSectionContent(
868868
style,
869869
result.resolvedApiItem,
870870
model,
871-
pkg
871+
pkg,
872+
customTags
872873
)
873874
if (linkText) {
874875
const encodedLinkText = escapeText(

src/resolver/multi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { GenerateStyle } from '../config'
1717
* @param item - a {@link https://rushstack.io/pages/api/api-extractor-model.apiitem/ | item}
1818
* @param model - a {@link https://rushstack.io/pages/api/api-extractor-model.apimodel/ | model}
1919
* @param pkg - a {@link https://rushstack.io/pages/api/api-extractor-model.apipackage/ | package}
20+
* @param customTags - TSDoc custom tags. This parameter is set to an array of custom tag names defined in `--tsdoc-config`.
2021
*
2122
* @returns resolved the reference string
2223
*
@@ -26,7 +27,8 @@ export function resolve(
2627
style: GenerateStyle,
2728
item: ApiItem,
2829
model: ApiModel,
29-
pkg: ApiPackage
30+
pkg: ApiPackage,
31+
customTags?: string[] // eslint-disable-line @typescript-eslint/no-unused-vars
3032
): string {
3133
let baseName = ''
3234
const pkgName = pkg.displayName

src/resolver/toc.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { GenerateStyle } from '../config'
1919
* @param item - a {@link https://rushstack.io/pages/api/api-extractor-model.apiitem/ | item}
2020
* @param model - a {@link https://rushstack.io/pages/api/api-extractor-model.apimodel/ | model}
2121
* @param pkg - a {@link https://rushstack.io/pages/api/api-extractor-model.apipackage/ | package}
22+
* @param customTags - TSDoc custom tags. This parameter is set to an array of custom tag names defined in `--tsdoc-config`.
2223
*
2324
* @returns resolved the reference string
2425
*
@@ -28,7 +29,8 @@ export function resolve(
2829
style: GenerateStyle,
2930
item: ApiItem,
3031
model: ApiModel,
31-
pkg: ApiPackage
32+
pkg: ApiPackage,
33+
customTags?: string[] // eslint-disable-line @typescript-eslint/no-unused-vars
3234
): string {
3335
let baseName = ''
3436
for (const hierarchyItem of item.getHierarchy()) {

0 commit comments

Comments
 (0)