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

@@ -7531,6 +7531,44 @@ export const generatedSidebar = [
]
}
]
},
{
"loaded": true,
"isPathHref": true,
"path": "/references/helper-steps",
"title": "Helper Steps Reference",
"isChildSidebar": true,
"autogenerate_path": "/references/helper_steps/functions",
"children": [
{
"loaded": true,
"isPathHref": true,
"path": "/references/helper-steps/createRemoteLinkStep",
"title": "createRemoteLinkStep",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"path": "/references/helper-steps/dismissRemoteLinkStep",
"title": "dismissRemoteLinkStep",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"path": "/references/helper-steps/removeRemoteLinkStep",
"title": "removeRemoteLinkStep",
"children": []
},
{
"loaded": true,
"isPathHref": true,
"path": "/references/helper-steps/useRemoteQueryStep",
"title": "useRemoteQueryStep",
"children": []
}
]
}
]
},

View File

@@ -1860,6 +1860,12 @@ export const sidebar = sidebarAttachHrefCommonOptions([
},
],
},
{
path: "/references/helper-steps",
title: "Helper Steps Reference",
isChildSidebar: true,
autogenerate_path: "/references/helper_steps/functions",
},
],
},
{

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)
})
}