docs: add sidebar item for helper reference + examples fix (#8365)

This commit is contained in:
Shahed Nasser
2024-07-31 17:28:42 +03:00
committed by GitHub
parent 6f973d9f2b
commit 22a629670b
3 changed files with 53 additions and 3 deletions

View File

@@ -1,9 +1,15 @@
import * as Handlebars from "handlebars"
import { Reflection } from "typedoc"
import { Reflection, SignatureReflection } from "typedoc"
import { isWorkflowStep } from "../../utils/step-utils"
export default function () {
Handlebars.registerHelper("example", function (reflection: Reflection) {
const exampleTag = reflection.comment?.blockTags.find(
const isStep =
reflection.variant === "signature" &&
isWorkflowStep(reflection as SignatureReflection)
const targetReflection =
isStep && reflection.parent ? reflection.parent : reflection
const exampleTag = targetReflection.comment?.blockTags.find(
(tag) => tag.tag === "@example"
)
@@ -11,6 +17,6 @@ export default function () {
return ""
}
return Handlebars.helpers.commentTag(exampleTag, reflection)
return Handlebars.helpers.commentTag(exampleTag, targetReflection)
})
}