mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
feat: add util package for generating search indices (#8571)
This commit is contained in:
24
packages/api-extractor-utils/src/tsdoc/RootComment.ts
Normal file
24
packages/api-extractor-utils/src/tsdoc/RootComment.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { ApiItem, ApiModel } from '@microsoft/api-extractor-model';
|
||||
import type { DocComment } from '@microsoft/tsdoc';
|
||||
import { createCommentNode } from '.';
|
||||
import { block, type DocBlockJSON } from './CommentBlock';
|
||||
import { type DocNodeJSON, node } from './CommentNode';
|
||||
|
||||
export interface DocCommentJSON extends DocNodeJSON {
|
||||
summary: DocNodeJSON[];
|
||||
remarks: DocNodeJSON[];
|
||||
deprecated: DocNodeJSON[];
|
||||
customBlocks: DocBlockJSON[];
|
||||
}
|
||||
|
||||
export function comment(comment: DocComment, model: ApiModel, version: string, parentItem?: ApiItem): DocCommentJSON {
|
||||
return {
|
||||
...node(comment),
|
||||
summary: comment.summarySection.nodes.map((node) => createCommentNode(node, model, version, parentItem)),
|
||||
remarks:
|
||||
comment.remarksBlock?.content.nodes.map((node) => createCommentNode(node, model, version, parentItem)) ?? [],
|
||||
deprecated:
|
||||
comment.deprecatedBlock?.content.nodes.map((node) => createCommentNode(node, model, version, parentItem)) ?? [],
|
||||
customBlocks: comment.customBlocks.map((_block) => block(_block, model, version, parentItem)),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user