diff --git a/src/components/Comment.tsx b/src/components/Comment.tsx index 8c817f4..10736bd 100644 --- a/src/components/Comment.tsx +++ b/src/components/Comment.tsx @@ -32,6 +32,18 @@ export function displayPartsToMarkdown(parts: JSONOutput.CommentDisplayPart[]): .join(''); } +const ADDED_IN_TAG = '@added_in'; + +function getAddedInVersion(comment: JSONOutput.Comment): string | null { + const tag = comment.blockTags?.find((blockTag) => blockTag.tag === ADDED_IN_TAG); + + if (!tag) { + return null; + } + + return displayPartsToMarkdown(tag.content).trim() || null; +} + export function Comment({ comment, root, hideTags = [] }: CommentProps) { if (!comment || !hasComment(comment)) { return null; @@ -40,17 +52,23 @@ export function Comment({ comment, root, hideTags = [] }: CommentProps) { // Hide custom tags. hideTags.push('@reference'); + const addedIn = getAddedInVersion(comment); + const blockTags = comment.blockTags?.filter((tag) => { if (hideTags.includes(tag.tag)) { return false; } - return tag.tag !== '@default'; + return tag.tag !== '@default' && tag.tag !== ADDED_IN_TAG; }) ?? []; return (