diff --git a/src/app/concepts/[slug]/page.tsx b/src/app/concepts/[slug]/page.tsx index 5fea939..445c4d9 100644 --- a/src/app/concepts/[slug]/page.tsx +++ b/src/app/concepts/[slug]/page.tsx @@ -1,6 +1,7 @@ import { notFound } from "next/navigation"; import { Metadata } from "next"; import Link from "next/link"; +import { parseInlineMarkdown } from "@/lib/markdown"; import { getConceptBySlug, getAllConceptSlugs, @@ -39,12 +40,7 @@ export async function generateMetadata({ params }: PageProps): Promise } } -function parseInlineMarkdown(text: string): string { - return text - .replace(/\*\*([^*]+)\*\*/g, "$1") - .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '$1') - .replace(/`([^`]+)`/g, "$1"); -} +// parseInlineMarkdown imported from @/lib/markdown function renderConceptBody(content: string) { const elements: { type: "p" | "h3" | "code" | "ul" | "table"; content: string }[] = []; diff --git a/src/app/functions/[slug]/page.tsx b/src/app/functions/[slug]/page.tsx index 0fc6080..5be3035 100644 --- a/src/app/functions/[slug]/page.tsx +++ b/src/app/functions/[slug]/page.tsx @@ -4,6 +4,7 @@ import { Metadata } from "next"; import Link from "next/link"; import { getFunctionBySlug, getAllFunctionSlugs, buildSearchIndex } from "@/lib/mdx"; import { PQTableData, ExampleStep } from "@/lib/types"; +import { parseInlineMarkdown } from "@/lib/markdown"; import FunctionHeader from "@/components/function-page/FunctionHeader"; import SyntaxBlock from "@/components/function-page/SyntaxBlock"; import ParametersTable from "@/components/function-page/ParametersTable"; @@ -102,12 +103,7 @@ function parseRemarks(content: string): string | null { return remarksMatch ? remarksMatch[1].trim() : null; } -function parseInlineMarkdown(text: string): string { - return text - .replace(/\*\*([^*]+)\*\*/g, "$1") - .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '$1') - .replace(/`([^`]+)`/g, "$1"); -} +// parseInlineMarkdown imported from @/lib/markdown function renderRemarks(remarks: string) { const elements: React.ReactElement[] = []; @@ -247,7 +243,7 @@ export default async function FunctionPage({ params }: PageProps) { }; return ( -
+