fix(catalog): preserve literal preview markers

This commit is contained in:
Tommaso Casaburi
2026-04-29 15:24:54 +07:00
parent f82e5f04b9
commit fd26d6fd10
5 changed files with 52 additions and 15 deletions
@@ -480,6 +480,22 @@ describe('CatalogRow', () => {
expect(container.textContent).toContain('Text title: Plain thread body');
});
it('preserves literal catalog teaser markers without applying body markdown styles', async () => {
const post: TestComment = {
cid: 'literal-markers',
content: '>we got 5chan before Half Life 3\n*poisons u*',
replyCount: 2,
communityAddress: 'music-posting.eth',
};
await renderWithRouter(createElement(CatalogRow, { row: [post] }), '/mu/catalog');
expect(container.textContent).toContain('>we got 5chan before Half Life 3');
expect(container.textContent).toContain('*poisons u*');
expect(container.querySelector('.greentext')).toBeNull();
expect(container.querySelector('.spoilertext')).toBeNull();
});
it('applies the estimated row height to the virtualization wrapper', async () => {
const post: TestComment = {
cid: 'estimated-post',
+2 -2
View File
@@ -18,7 +18,7 @@ import useCountLinksInReplies from '../../hooks/use-count-links-in-replies';
import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame';
import useHide from '../../hooks/use-hide';
import { isCommentArchived } from '../../lib/utils/comment-moderation-utils';
import { removeMarkdown } from '../../lib/utils/post-utils';
import { CATALOG_PREVIEW_MARKDOWN_OPTIONS, removeMarkdown } from '../../lib/utils/post-utils';
import PostMenuDesktop from '../post-desktop/post-menu-desktop';
import styles from './catalog-row.module.css';
import capitalize from 'lodash/capitalize';
@@ -215,7 +215,7 @@ const CatalogPost = memo(
{content ? ': ' : ''}
</span>
)}
{content && removeMarkdown(content)}
{content && removeMarkdown(content, CATALOG_PREVIEW_MARKDOWN_OPTIONS)}
</>
)}
</div>