docs-util: support @tags comments (#10627)
* support tags in tsdocs + add them in frontmatter * fixes
This commit is contained in:
@@ -6,4 +6,5 @@ export * from "./hooks-util"
|
||||
export * from "./step-utils"
|
||||
export * from "./str-formatting"
|
||||
export * from "./str-utils"
|
||||
export * from "./tag-utils"
|
||||
export * from "./workflow-utils"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { CommentTag, DeclarationReflection, Reflection } from "typedoc"
|
||||
|
||||
export const getTagsAsArray = (tag: CommentTag): string[] => {
|
||||
return tag.content
|
||||
.map((content) => content.text)
|
||||
.join("")
|
||||
.split(",")
|
||||
.map((value) => value.trim())
|
||||
}
|
||||
|
||||
export const getTagComments = (reflection: Reflection): CommentTag[] => {
|
||||
const tagComments: CommentTag[] = []
|
||||
|
||||
reflection.comment?.blockTags
|
||||
.filter((tag) => tag.tag === `@tags`)
|
||||
.forEach((tag) => tagComments.push(tag))
|
||||
|
||||
if (reflection instanceof DeclarationReflection) {
|
||||
reflection.signatures?.forEach((signature) =>
|
||||
tagComments.push(...getTagComments(signature))
|
||||
)
|
||||
}
|
||||
|
||||
return tagComments
|
||||
}
|
||||
Reference in New Issue
Block a user