master
1import { t } from '@utils/i18n';
2
3export function cleanCommentHtml(htmlString: string) {
4 return htmlString
5 .replaceAll(/<img.*?src="(.*?)"?[^>]+>/gi, t.info.commentAbbrs.image())
6 .replaceAll(
7 /<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,
8 t.info.commentAbbrs.link()
9 )
10 .replaceAll(/<pre><code[^>]+?>.*?<\/pre>/gis, t.info.commentAbbrs.code())
11 .replaceAll(/<[^>]+>/g, '');
12}