Skip to content

Scheduling infrastructure for absolutely everyone.

fix: render markdown in custom page redirect messages (#25987)

Anik Dhabal Babu1135e47338d9
diff --git a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingLink.tsx b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingLink.tsx
index f85228ebd5c..66dd20ea4b9 100644
--- a/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingLink.tsx
+++ b/apps/web/app/(use-page-wrapper)/apps/routing-forms/[...pages]/RoutingLink.tsx
@@ -19,6 +19,7 @@ import useGetBrandingColours from "@calcom/lib/getBrandColours";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import useTheme from "@calcom/lib/hooks/useTheme";
+import { markdownToSafeHTMLClient } from "@calcom/lib/markdownToSafeHTMLClient";
import { navigateInTopWindow } from "@calcom/lib/navigateInTopWindow";
import { trpc } from "@calcom/trpc/react";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
@@ -208,7 +209,10 @@ function RoutingForm({ form, profile, ...restProps }: Props) {
<div className="mx-auto my-0 max-w-3xl md:my-24">
<div className="w-full max-w-4xl ltr:mr-2 rtl:ml-2">
<div className="main sm:border-subtle bg-default -mx-4 rounded-md border border-neutral-200 p-4 py-6 sm:mx-0 sm:px-8">
- <div className="text-emphasis">{customPageMessage}</div>
+ <div
+ className="text-emphasis prose prose-sm dark:prose-invert max-w-none"
+ dangerouslySetInnerHTML={{ __html: markdownToSafeHTMLClient(customPageMessage) }}
+ />
</div>
</div>
</div>
diff --git a/apps/web/pages/router/index.tsx b/apps/web/pages/router/index.tsx
index 8aef8635161..c3dfa8cb7b7 100644
--- a/apps/web/pages/router/index.tsx
+++ b/apps/web/pages/router/index.tsx
@@ -2,6 +2,7 @@
import Head from "next/head";
+import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import PageWrapper from "@components/PageWrapper";
@@ -17,7 +18,12 @@ export default function Router({ form, message, errorMessage }: inferSSRProps<ty
<div className="mx-auto my-0 max-w-3xl md:my-24">
<div className="w-full max-w-4xl ltr:mr-2 rtl:ml-2">
<div className="text-default bg-default -mx-4 rounded-sm border border-neutral-200 p-4 py-6 sm:mx-0 sm:px-8">
- <div>{message || errorMessage}</div>
+ <div
+ className="prose prose-sm dark:prose-invert max-w-none"
+ dangerouslySetInnerHTML={{
+ __html: markdownToSafeHTML(message || errorMessage),
+ }}
+ />
</div>
</div>
</div>