docs-util: add support for workflows in markdown theme (#8485)
* add template for workflows * initial changes * added support for parallel steps * added support for when * added merge options * fix merge options * fix to tooltip * clean up * remove redirects * fixes * theme fixes + added merge options * generate hook examples + fixes * changed namespaces * add custom autogenerator * change type of additional data
This commit is contained in:
@@ -5,6 +5,7 @@ import { notFound } from "next/navigation"
|
||||
import {
|
||||
typeListLinkFixerPlugin,
|
||||
localLinksRehypePlugin,
|
||||
workflowDiagramLinkFixerPlugin,
|
||||
} from "remark-rehype-plugins"
|
||||
import MDXComponents from "@/components/MDXComponents"
|
||||
import mdxOptions from "../../../mdx-options.mjs"
|
||||
@@ -47,7 +48,20 @@ export default async function ReferencesPage({ params }: PageProps) {
|
||||
mdxOptions: {
|
||||
rehypePlugins: [
|
||||
...mdxOptions.options.rehypePlugins,
|
||||
[typeListLinkFixerPlugin, pluginOptions],
|
||||
[
|
||||
typeListLinkFixerPlugin,
|
||||
{
|
||||
...pluginOptions,
|
||||
checkLinksType: "md",
|
||||
},
|
||||
],
|
||||
[
|
||||
workflowDiagramLinkFixerPlugin,
|
||||
{
|
||||
...pluginOptions,
|
||||
checkLinksType: "value",
|
||||
},
|
||||
],
|
||||
[localLinksRehypePlugin, pluginOptions],
|
||||
],
|
||||
remarkPlugins: mdxOptions.options.remarkPlugins,
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import type { MDXComponents as MDXComponentsType } from "mdx/types"
|
||||
import { Link, MDXComponents as UiMdxComponents, TypeList } from "docs-ui"
|
||||
import {
|
||||
Link,
|
||||
MDXComponents as UiMdxComponents,
|
||||
TypeList,
|
||||
WorkflowDiagram,
|
||||
} from "docs-ui"
|
||||
|
||||
const MDXComponents: MDXComponentsType = {
|
||||
...UiMdxComponents,
|
||||
a: Link,
|
||||
TypeList,
|
||||
WorkflowDiagram,
|
||||
}
|
||||
|
||||
export default MDXComponents
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
brokenLinkCheckerPlugin,
|
||||
localLinksRehypePlugin,
|
||||
typeListLinkFixerPlugin,
|
||||
workflowDiagramLinkFixerPlugin,
|
||||
} from "remark-rehype-plugins"
|
||||
import { slugChanges } from "./generated/slug-changes.mjs"
|
||||
import mdxPluginOptions from "./mdx-options.mjs"
|
||||
@@ -15,6 +16,7 @@ const withMDX = mdx({
|
||||
[brokenLinkCheckerPlugin],
|
||||
[localLinksRehypePlugin],
|
||||
[typeListLinkFixerPlugin],
|
||||
[workflowDiagramLinkFixerPlugin],
|
||||
],
|
||||
remarkPlugins: mdxPluginOptions.options.remarkPlugins,
|
||||
jsx: true,
|
||||
@@ -29,14 +31,16 @@ const nextConfig = {
|
||||
transpilePackages: ["docs-ui"],
|
||||
|
||||
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2/resources",
|
||||
async redirects() {
|
||||
// redirect original file paths to the rewrite
|
||||
return slugChanges.map((item) => ({
|
||||
source: item.origSlug,
|
||||
destination: item.newSlug,
|
||||
permanent: true,
|
||||
}))
|
||||
},
|
||||
// Redirects shouldn't be necessary anymore since we have remark / rehype
|
||||
// plugins that fix links. But leaving this here in case we need it again.
|
||||
// async redirects() {
|
||||
// // redirect original file paths to the rewrite
|
||||
// return slugChanges.map((item) => ({
|
||||
// source: item.origSlug,
|
||||
// destination: item.newSlug,
|
||||
// permanent: true,
|
||||
// }))
|
||||
// },
|
||||
}
|
||||
|
||||
export default withMDX(nextConfig)
|
||||
|
||||
@@ -1888,6 +1888,13 @@ export const sidebar = sidebarAttachHrefCommonOptions([
|
||||
isChildSidebar: true,
|
||||
autogenerate_path: "/references/helper_steps/functions",
|
||||
},
|
||||
// TODO uncomment once available.
|
||||
// {
|
||||
// title: "Medusa Workflows Reference",
|
||||
// path: "/medusa-workflows-reference",
|
||||
// isChildSidebar: true,
|
||||
// custom_autogenerate: "core-flows",
|
||||
// },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user