From 032962f5775d64959cce9fd2708c27f0b1b0cabe Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Date: Fri, 3 Jul 2026 11:52:08 +0530 Subject: [PATCH] fix(ui): render markdown headings properly in event descriptions (#29648) * fix(ui): render markdown headings properly in event descriptions * fix(ui): Add noopener and noreferrer to external links in markdownToSafeHTML * fix(ui): revert external link changes in markdownToSafeHTML * fix(ui): update markdown heading styles --- packages/lib/markdownToSafeHTML.ts | 9 +++++---- packages/lib/markdownToSafeHTMLClient.ts | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/lib/markdownToSafeHTML.ts b/packages/lib/markdownToSafeHTML.ts index b805b1a335..e6de95bd7a 100644 --- a/packages/lib/markdownToSafeHTML.ts +++ b/packages/lib/markdownToSafeHTML.ts @@ -1,6 +1,5 @@ -import sanitizeHtml from "sanitize-html"; - import { md } from "@calcom/lib/markdownIt"; +import sanitizeHtml from "sanitize-html"; if (typeof window !== "undefined") { // This file imports markdown parser which is a costly dependency, so we want to make sure it's not imported on the client side. @@ -24,7 +23,9 @@ export function markdownToSafeHTML(markdown: string | null) { /
    /g, "
      " ) - .replace(/") + .replace(/]*>/g, "

      "); // Match:
    1. Some text
      • ...
    2. // Convert to:
    3. Some text
        ...
    4. @@ -34,4 +35,4 @@ export function markdownToSafeHTML(markdown: string | null) { ); return safeHTMLWithListFormatting; -} +} \ No newline at end of file diff --git a/packages/lib/markdownToSafeHTMLClient.ts b/packages/lib/markdownToSafeHTMLClient.ts index 434f4aa9c8..4e35f5467b 100644 --- a/packages/lib/markdownToSafeHTMLClient.ts +++ b/packages/lib/markdownToSafeHTMLClient.ts @@ -1,6 +1,5 @@ -import DOMPurify from "dompurify"; - import { md } from "@calcom/lib/markdownIt"; +import DOMPurify from "dompurify"; if (typeof window == "undefined") { console.warn( @@ -24,7 +23,9 @@ export function markdownToSafeHTMLClient(markdown: string | null) { /
        /g, "
          " ) - .replace(/") + .replace(/]*>/g, "

          "); // Match:
        1. Some text
          • ...
        2. or // Convert to:
        3. Some text
            ...