Skip to content

Commit c4eedea

Browse files
committed
strip link tags from preview paragraph
1 parent 539396e commit c4eedea

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

build/utils.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ export function extractFirstBigParagraph(html: string): string {
1414
return '';
1515
}
1616

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

23-
return '';
21+
return result;
2422
}
2523

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

0 commit comments

Comments
 (0)