From 480e5796ec55d7cae32799b3888042382d17600d Mon Sep 17 00:00:00 2001 From: nitin <142569587+ehconitin@users.noreply.github.com> Date: Wed, 29 Apr 2026 17:20:32 +0530 Subject: [PATCH] fix(ai): render record links inside markdown headings in AI chat (#20074) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Adds `h1`–`h6` component overrides to `LazyMarkdownRenderer` so that `[[record:...]]` references placed inside markdown headings in the AI chat are parsed by `processChildrenForRecordLinks` and rendered as clickable `RecordLink` chips, matching the behavior already in place for `p`, `li`, `td`, `th`, and `a`. Fixes #20072 ## Test plan - [ ] In AI chat, ask a question whose answer places a record reference inside a markdown heading (e.g. `## Found [[person:uuid:John Doe]]`) and confirm a clickable `RecordLink` chip renders instead of the raw `[[...]]` text. - [ ] Verify heading styling (sizes, weights, margins) is unchanged. Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: nitin --- .../ai/components/LazyMarkdownRenderer.tsx | 18 ++++++++++++++++++ .../constants/chat-system-prompts.const.ts | 1 + 2 files changed, 19 insertions(+) diff --git a/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx b/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx index 315c21ad5b..43f60f32e9 100644 --- a/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx +++ b/packages/twenty-front/src/modules/ai/components/LazyMarkdownRenderer.tsx @@ -121,6 +121,24 @@ const MarkdownRenderer = lazy(async () => { li: ({ children }) => (
  • {processChildrenForRecordLinks(children)}
  • ), + h1: ({ children }) => ( +

    {processChildrenForRecordLinks(children)}

    + ), + h2: ({ children }) => ( +

    {processChildrenForRecordLinks(children)}

    + ), + h3: ({ children }) => ( +

    {processChildrenForRecordLinks(children)}

    + ), + h4: ({ children }) => ( +

    {processChildrenForRecordLinks(children)}

    + ), + h5: ({ children }) => ( +
    {processChildrenForRecordLinks(children)}
    + ), + h6: ({ children }) => ( +
    {processChildrenForRecordLinks(children)}
    + ), a: ({ children, href, title, node: _node }) => (