From c303a8cbf2da2d10235fff19c0af41ddb0ba5313 Mon Sep 17 00:00:00 2001 From: H1d3rOne Date: Sat, 7 Mar 2026 17:58:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96markdown=E8=BD=ACHTML?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=89=80=E6=9C=89=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=BD=AC=E6=8D=A2=E4=B8=94=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA*=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加三星号(***)转换支持 - 添加下划线(__和_)转换支持 - 优化列表项转换,支持*、+、-、•等符号 - 确保所有markdown标记都被正确转换 - 保持原有样式和布局 --- xuan-deduct-uniapp/src/utils/markdownToHtml.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xuan-deduct-uniapp/src/utils/markdownToHtml.js b/xuan-deduct-uniapp/src/utils/markdownToHtml.js index be7b1fe..9a7815c 100644 --- a/xuan-deduct-uniapp/src/utils/markdownToHtml.js +++ b/xuan-deduct-uniapp/src/utils/markdownToHtml.js @@ -13,11 +13,16 @@ export function markdownToHtml(markdown) { html = html.replace(/^## (.*$)/gim, '

$1

') html = html.replace(/^# (.*$)/gim, '

$1

') + html = html.replace(/\*\*\*(.+?)\*\*\*/g, '$1') html = html.replace(/\*\*(.+?)\*\*/g, '$1') html = html.replace(/\*(.+?)\*/g, '$1') + html = html.replace(/__(.+?)__/g, '$1') + html = html.replace(/_(.+?)_/g, '$1') html = html.replace(/`(.+?)`/g, '$1') html = html.replace(/^\s*[-•]\s(.+)$/gim, '
  • $1
  • ') + html = html.replace(/^\s*\*\s(.+)$/gim, '
  • $1
  • ') + html = html.replace(/^\s*\+\s(.+)$/gim, '
  • $1
  • ') html = html.replace(/(]*>.*<\/li>\n?)+/g, function(match) { return ''