Skip to content

Commit e66f3f2

Browse files
committed
Strip markdown formatting from Leela list descriptions
1 parent 0b8237e commit e66f3f2

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

web/src/components/features/LeelaList.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ interface LeelaListProps {
1212
hasMoreInitial: boolean;
1313
}
1414

15+
// Helper function to strip markdown formatting
16+
const stripMarkdown = (text: string) => {
17+
return text
18+
.replace(/\*\*/g, '') // Remove bold markers
19+
.replace(/\*/g, '') // Remove italic markers
20+
.replace(/\[([^\]]+)\]\([^\)]+\)/g, '$1') // Convert links to plain text
21+
.replace(/`/g, ''); // Remove code markers
22+
};
23+
1524
export default function LeelaList({ initialItems, total, hasMoreInitial }: LeelaListProps) {
1625
const [items, setItems] = useState(initialItems);
1726
const [page, setPage] = useState(1);
@@ -78,7 +87,7 @@ export default function LeelaList({ initialItems, total, hasMoreInitial }: Leela
7887
{article.title_hindi}
7988
</h3>
8089
<p className="text-gray-600 text-sm line-clamp-2">
81-
{article.description}
90+
{stripMarkdown(article.description)}
8291
</p>
8392
</div>
8493
</div>

0 commit comments

Comments
 (0)