Skip to content

Commit

Permalink
chore: removing points and comments text for display
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasgriffintn committed Aug 25, 2024
1 parent c57a003 commit 136ca05
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/web/app/components/homepage/search-result-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ function stripHtmlTagsAndDecode(html: string): string {
return entities[entity] || match;
});

// Remove lines starting with "Points:" or "# Comments:"
const cleanedText = decodedText.replace(/^(Points:|# Comments:).*\n?/gm, '');

// Remove leading and trailing new lines and ensure no more than one consecutive new line
return decodedText.trim().replace(/\n+/g, '\n');
return cleanedText.trim().replace(/\n+/g, '\n');
}

function renderTextWithNewLines(text: string, url: string): JSX.Element {
Expand Down

0 comments on commit 136ca05

Please sign in to comment.