feat(website): render @deprecated and @remarks blocks (#8511)

This commit is contained in:
Suneet Tipirneni
2022-08-17 15:51:29 -04:00
committed by GitHub
parent e147c5bd64
commit 0be85fd101
7 changed files with 43 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ export class DocItem<T extends ApiDeclaredItem = ApiDeclaredItem> {
public readonly kind: string;
public readonly remarks: DocNodeContainerJSON | null;
public readonly summary: DocNodeContainerJSON | null;
public readonly deprecated: DocNodeContainerJSON | null;
public readonly containerKey: string;
public readonly comment: AnyDocNodeJSON | null;
@@ -34,6 +35,9 @@ export class DocItem<T extends ApiDeclaredItem = ApiDeclaredItem> {
this.summary = item.tsdocComment?.summarySection
? (createCommentNode(item.tsdocComment.summarySection, model, item.parent) as DocNodeContainerJSON)
: null;
this.deprecated = item.tsdocComment?.deprecatedBlock
? (createCommentNode(item.tsdocComment.deprecatedBlock, model, item.parent) as DocNodeContainerJSON)
: null;
this.containerKey = item.containerKey;
this.comment = item.tsdocComment ? createCommentNode(item.tsdocComment, model, item.parent) : null;
}
@@ -63,6 +67,7 @@ export class DocItem<T extends ApiDeclaredItem = ApiDeclaredItem> {
excerptTokens: this.excerptTokens,
kind: this.kind,
remarks: this.remarks,
deprecated: this.deprecated,
path: this.path,
containerKey: this.containerKey,
comment: this.comment,

View File

@@ -7,6 +7,7 @@ import { DocNodeJSON, node } from './CommentNode';
export interface DocCommentJSON extends DocNodeJSON {
summary: DocNodeJSON[];
remarks: DocNodeJSON[];
deprecated: DocNodeJSON[];
customBlocks: DocBlockJSON[];
}
@@ -15,6 +16,7 @@ export function comment(comment: DocComment, model: ApiModel, parentItem?: ApiIt
...node(comment),
summary: comment.summarySection.nodes.map((node) => createCommentNode(node, model, parentItem)),
remarks: comment.remarksBlock?.content.nodes.map((node) => createCommentNode(node, model, parentItem)) ?? [],
deprecated: comment.deprecatedBlock?.content.nodes.map((node) => createCommentNode(node, model, parentItem)) ?? [],
customBlocks: comment.customBlocks.map((_block) => block(_block, model, parentItem)),
};
}