Skip to content

Commit

Permalink
strip link tags from preview paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
fmalcher committed Nov 18, 2024
1 parent 539396e commit c4eedea
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ export function extractFirstBigParagraph(html: string): string {
return '';
}

for (const match of matches) {
if (match && match.length > 100) {
return match;
}
}
const paragraph = matches.find(m => m && m.length > 100) || '';
// strip anchor tags but retain link text
const result = paragraph.replace(/<a\s.*?>(.*?)<\/a>/g, '$1');

return '';
return result;
}

export function makeLightBlogList(fullList: BlogEntry[]): BlogEntryLight[] {
Expand Down

0 comments on commit c4eedea

Please sign in to comment.