确定气泡字体样式

This commit is contained in:
2026-07-24 16:56:07 +08:00
parent dc4f6b2132
commit 594775424a
18 changed files with 134 additions and 584 deletions

View File

@@ -407,8 +407,13 @@
html += '<tr>'
cells.forEach((cell, ci) => {
const align = alignments[ci] ? ` style="text-align:${alignments[ci]}"` : ''
// 修复:转义表格单元格中的 _ 和 *,防止 snarkdown 将其解析为斜体/加粗
let cellContent = cell.trim()
// 1. 先处理 Markdown 粗体 **...**
cellContent = cellContent.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
// 2. 再处理 Markdown 斜体 *...*
cellContent = cellContent.replace(/\*(.+?)\*/g, '<em>$1</em>')
// 3. 转义剩余的 _ 和 *,防止 snarkdown 将其解析为斜体/加粗
cellContent = cellContent
.replace(/_/g, '&#95;')
.replace(/\*/g, '&#42;')
html +=
@@ -1512,7 +1517,19 @@
<!-- v-html 渲染的 markdown 内容无法被 scoped 样式命中需非 scoped 样式块 -->
<style lang="scss">
/* 气泡内容字体:确保 v-html 渲染的 markdown 内容使用系统字体栈 */
.chat-content {
// font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'HarmonyOS Sans', 'MiSans',
// 'Source Han Sans CN', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
// font-weight: 400;
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'HarmonyOS Sans', 'MiSans',
'Source Han Sans CN', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif !important;
font-size: 16px !important;
font-weight: 600 !important;
line-height: 1.6;
margin: 8rpx 0;
h1 {
font-size: 42rpx;
line-height: 1.4;
@@ -1543,11 +1560,25 @@
p,
text,
span {
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'HarmonyOS Sans', 'MiSans',
'Source Han Sans CN', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif !important;
font-size: 38rpx !important;
font-weight: 400 !important;
line-height: 1.6;
margin: 8rpx 0;
}
/* 粗体和斜体样式 */
strong,
b {
font-weight: 600 !important;
}
em,
i {
font-style: italic !important;
}
/* 气泡内的内联链接(替代 <a> 标签,点击由 JS 拦截处理) */
.chat-inline-link {
color: #3b86ff !important;