Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(markdown): align renderer configuration (#19926)

Innei759ecb5885be
diff --git a/src/features/Conversation/WorkingSidebar/PullRequest/ActivityTimeline.tsx b/src/features/Conversation/WorkingSidebar/PullRequest/ActivityTimeline.tsx
index b93ad42fed0..a07d348d195 100644
--- a/src/features/Conversation/WorkingSidebar/PullRequest/ActivityTimeline.tsx
+++ b/src/features/Conversation/WorkingSidebar/PullRequest/ActivityTimeline.tsx
@@ -178,7 +178,7 @@ const ActivityTimeline = memo<ActivityTimelineProps>(({ busy, detail, onAction }
<span>{timeAgo(entry.at)}</span>
</Flexbox>
<div className={styles.commentBodyWrap}>
- <Markdown allowHtml className={styles.commentBody} fontSize={13} variant={'chat'}>
+ <Markdown className={styles.commentBody} fontSize={13} variant={'chat'}>
{entry.body}
</Markdown>
</div>
diff --git a/src/features/Conversation/WorkingSidebar/PullRequest/Sections.tsx b/src/features/Conversation/WorkingSidebar/PullRequest/Sections.tsx
index 09ef9ef8812..c9a5cb30e1e 100644
--- a/src/features/Conversation/WorkingSidebar/PullRequest/Sections.tsx
+++ b/src/features/Conversation/WorkingSidebar/PullRequest/Sections.tsx
@@ -146,7 +146,7 @@ const Sections = memo<SectionsProps>(({ activity, busy, detail, onAction, onOpen
title={t('workingPanel.pr.section.description')}
onToggle={toggle('description')}
>
- <Markdown allowHtml className={styles.body} fontSize={13} variant={'chat'}>
+ <Markdown className={styles.body} fontSize={13} variant={'chat'}>
{detail.body}
</Markdown>
</Section>
diff --git a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
index 35cebe728a2..c37366ae9c0 100644
--- a/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/__tests__/index.test.tsx
@@ -1,3 +1,4 @@
+import type { DeviceGitPullRequestDetail } from '@lobechat/types';
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
import type { CSSProperties, MouseEvent, ReactNode } from 'react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -7,6 +8,7 @@ import { messageMapKey } from '@/store/chat/utils/messageMapKey';
import type { ComposerTarget } from '../../types';
import AgentWorkingSidebar from '../index';
+import PullRequestSections from '../PullRequest/Sections';
// ─── captured RightPanel props ────────────────────────────────────────────────
// The real RightPanel is a controlled DraggablePanel; here we stub it so the test
@@ -758,6 +760,65 @@ describe('AgentWorkingSidebar β€” controlled panel width', () => {
});
});
+describe('Pull request Markdown', () => {
+ it('renders standard Markdown without creating raw HTML elements', () => {
+ const rawHtml = '<aside data-raw-html="true">raw HTML</aside>';
+ const detail: DeviceGitPullRequestDetail = {
+ additions: 1,
+ author: 'lobehub',
+ autoMerge: null,
+ baseBehindBy: 0,
+ baseRefName: 'canary',
+ body: `**description-safe**\n\n${rawHtml}`,
+ changedFiles: 1,
+ checks: [],
+ comments: [
+ {
+ author: 'contributor',
+ body: `**comment-safe**\n\n${rawHtml}`,
+ createdAt: '2026-09-24T00:00:00Z',
+ id: 'comment-1',
+ },
+ ],
+ commits: [],
+ deletions: 0,
+ headRefName: 'fix/markdown',
+ headRefOid: 'a'.repeat(40),
+ isCrossRepository: false,
+ isDraft: false,
+ mergeable: 'MERGEABLE',
+ mergeStateStatus: 'CLEAN',
+ number: 1,
+ repo: { name: 'lobehub', owner: 'lobehub' },
+ reviewDecision: null,
+ reviews: [],
+ state: 'open',
+ title: 'Markdown rendering',
+ url: 'https://github.com/lobehub/lobehub/pull/1',
+ viewerCanBypass: false,
+ viewerCanWrite: true,
+ };
+
+ const { container } = render(
+ <PullRequestSections
+ detail={detail}
+ activity={{
+ data: { comments: detail.comments, commits: [], reviews: [] },
+ error: undefined,
+ isValidating: false,
+ mutate: vi.fn(),
+ }}
+ onAction={vi.fn().mockResolvedValue(true)}
+ onOpenTab={vi.fn()}
+ />,
+ );
+
+ expect(screen.getByText('description-safe', { selector: 'strong' })).toBeInTheDocument();
+ expect(screen.getByText('comment-safe', { selector: 'strong' })).toBeInTheDocument();
+ expect(container.querySelector('[data-raw-html]')).not.toBeInTheDocument();
+ });
+});
+
describe('AgentWorkingSidebar β€” tab strip', () => {
// Regression: at the 300px minimum panel width, labels such as β€œDeployments”
// were allowed to shrink and wrap inside words. Tabs now stay on one line in a
diff --git a/src/routes/(main)/community/(detail)/_layout/Header.test.tsx b/src/routes/(main)/community/(detail)/_layout/Header.test.tsx
index 1ed8b888b3a..3267c25606b 100644
--- a/src/routes/(main)/community/(detail)/_layout/Header.test.tsx
+++ b/src/routes/(main)/community/(detail)/_layout/Header.test.tsx
@@ -3,6 +3,7 @@ import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router';
import { describe, expect, it, vi } from 'vitest';
+import MarkdownRender from '../features/MakedownRender';
import Header from './Header';
const mocks = vi.hoisted(() => ({
@@ -61,3 +62,16 @@ describe('Community detail Header', () => {
);
});
});
+
+describe('Community detail Markdown', () => {
+ it('renders standard Markdown without creating raw HTML elements', () => {
+ const { container } = render(
+ <MarkdownRender>
+ {'**community-safe**\n\n<aside data-raw-html="true">raw HTML</aside>'}
+ </MarkdownRender>,
+ );
+
+ expect(screen.getByText('community-safe', { selector: 'strong' })).toBeInTheDocument();
+ expect(container.querySelector('[data-raw-html]')).not.toBeInTheDocument();
+ });
+});
diff --git a/src/routes/(main)/community/(detail)/features/MakedownRender.tsx b/src/routes/(main)/community/(detail)/features/MakedownRender.tsx
index 14963a40289..215cbeceb3f 100644
--- a/src/routes/(main)/community/(detail)/features/MakedownRender.tsx
+++ b/src/routes/(main)/community/(detail)/features/MakedownRender.tsx
@@ -24,7 +24,6 @@ const MarkdownRender = memo<{ children?: string }>(({ children }) => {
return (
<Markdown
- allowHtml
enableImageGallery={false}
enableLatex={false}
components={{