Add markdown support to policy agent UI#8174
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Dependency ReviewThe following issues were found:
Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned Files
|
galvana
pushed a commit
that referenced
this pull request
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket ENG-3782
Description Of Changes
Adds markdown rendering to agent responses in the policy builder agent chat. Until now the agent's replies rendered as plain text, so anything the LLM emitted with structure — headings, bullet/numbered lists, inline code, bold, links, fenced code blocks, tables — showed up as raw characters. This PR routes agent (AI-role) bubble content through
@ant-design/x-markdown'sXMarkdowncomponent, wrapped in antdTypographyso rendered elements inherit the design system's text styles.User-role bubbles are unchanged — rendering user input as markdown would mangle accidental special characters in their prompts.
Notable details:
@ant-design/x(already infidesui) doesn't ship one —@ant-design/x-markdownis a separate package by the same authors. It bundlesmarked+dompurify, so output is sanitized by default.fidesuire-exportsXMarkdownfrom@ant-design/x-markdown/es. The/lib(CJS) build does deeprequire("./*.css")calls that Turbopack errors on with "module factory is not available". The ESM build'simport "./*.css"goes through Next's CSS pipeline cleanly. To keep Jest happy with raw ESM in node_modules, the package is added tojest.config.jstransformIgnorePatternsso babel-jest transforms it.escapeRawHtmlenabled. Raw HTML in markdown is rendered as plain text rather than parsed — defense in depth against the agent emitting<script>or other unintended tags, on top of the package's built-in DOMPurify sanitization.display: block; width: max-content; max-width: 100%; overflow: autoso they can scroll horizontally. Tailwind's preflight (:where(*) { word-wrap: break-word }) and the package's own.x-markdown div/span/li { word-break: break-word }were collapsing cell content (including inline<strong>) so the table never grew wide enough to trigger overflow. A small override on table cells + descendants restores natural wrapping (word-break: normal; overflow-wrap: normal), so prose cells wrap at word boundaries and long unbreakable runs (URLs, identifiers) force the horizontal scroll the package already supports.<1280pxbreakpoint) so rendered lists, code blocks, and tables have a bit more breathing room.Code Changes
@ant-design/x-markdowntoclients/fidesui/package.jsonand re-exportedXMarkdownfromclients/fidesui/src/index.tsvia the ESM (/es) entry.clients/admin-ui/jest.config.jstransformIgnorePatternsto allow babel-jest to transform@ant-design/x-markdown.XMarkdownintoAgentChatPanel.tsxvia theairole'scontentRender. The renderer is hoisted to module scope to satisfyreact/no-unstable-nested-components. PassesescapeRawHtmlfor safety..x-markdownstyles inAgentChatPanel.module.scssto zero out the default list padding/margin and to fix table-cell wrapping so horizontal scroll triggers when needed.AccessPolicyEditor.module.scssto fit richer content.Steps to Confirm
coderender as styled elements (not raw**...**etc.).<script>alert(1)</script>in its reply. Confirm it renders as visible text rather than executing.Pre-Merge Checklist
CHANGELOG.mdupdated