From e5d66d73cbcecab1c520bc3ccbd502496df93ea2 Mon Sep 17 00:00:00 2001
From: smallclover <18363998103@163.com>
Date: Fri, 17 Oct 2025 22:34:58 +0900
Subject: [PATCH] =?UTF-8?q?markdown=20=E8=B0=83=E8=AF=95=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E4=B8=AD=E7=9A=84=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=E5=88=A0?=
=?UTF-8?q?=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend_nuxt/utils/markdown.js | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/frontend_nuxt/utils/markdown.js b/frontend_nuxt/utils/markdown.js
index be28d6dfb..7a6a89caf 100644
--- a/frontend_nuxt/utils/markdown.js
+++ b/frontend_nuxt/utils/markdown.js
@@ -268,23 +268,21 @@ export function stripMarkdownLength(text, length) {
// 朴素文本带贴吧表情
export function stripMarkdownWithTiebaMoji(text, length){
- console.error(text)
if (!text) return ''
- // Markdown 转成纯文本
- const plain = stripMarkdown(text)
- console.error(plain)
- // 替换 :tieba123: 为
- const withEmoji = plain.replace(/:tieba(\d+):/g, (match, num) => {
- const key = `tieba${num}`
- const file = tiebaEmoji[key]
- return file
- ? `
`
- : match // 没有匹配到图片则保留原样
- })
+ // Markdown 转成纯文本
+ const plain = stripMarkdown(text)
+ // 替换 :tieba123: 为
+ const withEmoji = plain.replace(/:tieba(\d+):/g, (match, num) => {
+ const key = `tieba${num}`
+ const file = tiebaEmoji[key]
+ return file
+ ? `
`
+ : match // 没有匹配到图片则保留原样
+ })
- // 截断纯文本长度(防止撑太长)
- const truncated = withEmoji.length > length ? withEmoji.slice(0, length) + '...' : withEmoji
- return truncated
+ // 截断纯文本长度(防止撑太长)
+ const truncated = withEmoji.length > length ? withEmoji.slice(0, length) + '...' : withEmoji
+ return truncated
}