From 22a629670b593f937fe592f7429d5a81c299b5e5 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Wed, 31 Jul 2024 17:28:42 +0300 Subject: [PATCH] docs: add sidebar item for helper reference + examples fix (#8365) --- www/apps/resources/generated/sidebar.mjs | 38 +++++++++++++++++++ www/apps/resources/sidebar.mjs | 6 +++ .../src/resources/helpers/example.ts | 12 ++++-- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/www/apps/resources/generated/sidebar.mjs b/www/apps/resources/generated/sidebar.mjs index 651ae5c688..fcabaaa514 100644 --- a/www/apps/resources/generated/sidebar.mjs +++ b/www/apps/resources/generated/sidebar.mjs @@ -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": [] + } + ] } ] }, diff --git a/www/apps/resources/sidebar.mjs b/www/apps/resources/sidebar.mjs index af1d468065..9ff75f74a3 100644 --- a/www/apps/resources/sidebar.mjs +++ b/www/apps/resources/sidebar.mjs @@ -1860,6 +1860,12 @@ export const sidebar = sidebarAttachHrefCommonOptions([ }, ], }, + { + path: "/references/helper-steps", + title: "Helper Steps Reference", + isChildSidebar: true, + autogenerate_path: "/references/helper_steps/functions", + }, ], }, { diff --git a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/example.ts b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/example.ts index e9c570967a..0fa630e93d 100644 --- a/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/example.ts +++ b/www/utils/packages/typedoc-plugin-markdown-medusa/src/resources/helpers/example.ts @@ -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) }) }