Skip to content

Commit d67a312

Browse files
committed
feat: 增加了对于富文本log中html tag的预清洗
1 parent 33dffd2 commit d67a312

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/io/import/cleaner.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ export function cleanContent(rawContent: string): string {
77
// 删除CQ 码
88
.replace(/\[CQ:[^\]]+\]/g, '')
99

10-
// 删除 HTML 标签
10+
// 删除常见 HTML tag
1111
.replace('<!--', '')
1212
.replace('-->', '')
13-
// .replace(/<[^>]+>/g, '')
14-
// 在找到更好的办法之前,暂时先不过滤了,以免误伤骰娘的回复
13+
.replace(
14+
/<\/?(img|span|div|p|a|b|i|u|strong|style|script)\b[^>]*>/gi,
15+
'',
16+
)
1517

1618
// 删除行首的 #
1719
.replace(/^#/gm, '')

0 commit comments

Comments
 (0)