Skip to content

Commit f0eb259

Browse files
committed
feat: enable markdown sanitization by removing code blocks and unwrapping inline code
1 parent 543cbd5 commit f0eb259

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/scripts/transform-message-for-card.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ const createUserLink = (user: GitHubUser) =>
6161
const sanitizeMarkdown = (text: string): string => {
6262
return text
6363
// 移除代码块
64-
// .replace(/```[\s\S]*?```/g, '[代码块]')
64+
.replace(/```[\s\S]*?```/g, '[代码块]')
6565
// 移除行内代码
66-
// .replace(/`[^`]+`/g, (match) => match.slice(1, -1))
66+
.replace(/`[^`]+`/g, (match) => match.slice(1, -1))
6767
// 将图片转换为链接文本
6868
.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '🖼️ [$1]($2)')
6969
// 将 ### 标题转换为加粗

0 commit comments

Comments
 (0)