Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Ftt_Common
Commits
9d6c2bdf
Commit
9d6c2bdf
authored
Aug 27, 2026
by
段廷瑞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pref: markdown渲染优化
parent
1ac5825c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
6 deletions
+55
-6
AgentTest.csproj
AgentTest/AgentTest.csproj
+1
-0
MarkdownRendererTests.cs
AgentTest/MarkdownRendererTests.cs
+43
-0
MarkdownRenderer.cs
Tools/MyAgent/Support/MarkdownRenderer.cs
+6
-1
Tools.csproj
Tools/Tools.csproj
+5
-5
No files found.
AgentTest/AgentTest.csproj
View file @
9d6c2bdf
...
...
@@ -70,6 +70,7 @@
<Compile
Include=
"EmbeddingClientTests.cs"
/>
<Compile
Include=
"ToolPermissionTests.cs"
/>
<Compile
Include=
"TextEncodingTests.cs"
/>
<Compile
Include=
"MarkdownRendererTests.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\Tools\Tools.csproj"
>
...
...
AgentTest/MarkdownRendererTests.cs
0 → 100644
View file @
9d6c2bdf
using
System
;
using
System.Collections.Generic
;
using
Tools.MyAgent
;
namespace
AgentTest
{
/// <summary>
/// MarkdownRenderer 渲染回归测试(D7:数字序号后键帽方框)
/// </summary>
public
class
MarkdownRendererTests
:
TestRunner
{
private
static
string
Render
(
string
content
)
{
return
MarkdownRenderer
.
BuildChatRtf
(
new
List
<
ChatMessage
>
{
new
ChatMessage
{
Role
=
"assistant"
,
Content
=
content
,
Timestamp
=
DateTime
.
Now
}
},
null
);
}
[
Test
]
public
void
KeycapEmoji_NoTofuBoxAfterDigit
()
{
// "### 1️⃣ 排查方法论" = '1' + U+FE0F(VS16) + U+20E3(键帽)。
// 回归:U+20E3 不得以 \u8355? 残留(微软雅黑缺字形 → 数字序号后渲染出方框 □)。
string
rtf
=
Render
(
"### 1️⃣ 排查方法论"
);
Assert
.
NotContains
(
rtf
,
@"\u8355?"
,
"键帽 U+20E3 转义残留"
);
Assert
.
NotContains
(
rtf
,
@"\u-497?"
,
"VS16 U+FE0F 转义残留"
);
// 数字 1 与正文应完整保留(方 26041 / 法 27861 / 论 U+8BBA 超 short 范围 → -29766)
Assert
.
Contains
(
rtf
,
@"\u26041?\u27861?\u-29766?"
,
"正文缺失"
);
}
[
Test
]
public
void
OrderedList_StillRendered
()
{
string
rtf
=
Render
(
"1. Step one\n2. Step two"
);
Assert
.
Contains
(
rtf
,
"1. Step one"
);
Assert
.
Contains
(
rtf
,
"2. Step two"
);
}
}
}
Tools/MyAgent/Support/MarkdownRenderer.cs
View file @
9d6c2bdf
...
...
@@ -612,9 +612,14 @@ namespace Tools.MyAgent
}
}
/// <summary>零宽/不可见格式字符(D4):无展示价值且多数字体缺字形,丢弃避免显示 □</summary>
/// <summary>零宽/不可见格式字符(D4
/D7
):无展示价值且多数字体缺字形,丢弃避免显示 □</summary>
private
static
bool
IsInvisibleFormatChar
(
char
c
)
{
// 组合用符号区段(U+20D0–U+20FF,D7):组合修饰符,单独无展示价值且微软雅黑缺字形。
// 如 1️⃣ 的键帽 U+20E3(VS16 已在上方丢弃),若保留会转义为 \u8355? 并以微软雅黑渲染,
// 缺字形 → 数字序号后紧跟方框 □;整体丢弃后仅剩纯数字,无内容损失。
if
(
c
>=
0x20D0
&&
c
<=
0x20FF
)
return
true
;
switch
(
c
)
{
case
'\
u00AD
'
:
// 软连字符
...
...
Tools/Tools.csproj
View file @
9d6c2bdf
...
...
@@ -42,7 +42,7 @@
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"BouncyCastle.Crypto, Version=1.8.6.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"
>
<HintPath>
..\
FunnyPick\
packages\Portable.BouncyCastle.1.8.6\lib\net40\BouncyCastle.Crypto.dll
</HintPath>
<HintPath>
..\packages\Portable.BouncyCastle.1.8.6\lib\net40\BouncyCastle.Crypto.dll
</HintPath>
</Reference>
<Reference
Include=
"ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"
>
<HintPath>
..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll
</HintPath>
...
...
@@ -57,16 +57,16 @@
<HintPath>
..\packages\Npgsql.6.0.3\lib\netstandard2.0\Npgsql.dll
</HintPath>
</Reference>
<Reference
Include=
"NPOI, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"
>
<HintPath>
..\
FunnyPick\
packages\NPOI.2.5.1\lib\net45\NPOI.dll
</HintPath>
<HintPath>
..\packages\NPOI.2.5.1\lib\net45\NPOI.dll
</HintPath>
</Reference>
<Reference
Include=
"NPOI.OOXML, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"
>
<HintPath>
..\
FunnyPick\
packages\NPOI.2.5.1\lib\net45\NPOI.OOXML.dll
</HintPath>
<HintPath>
..\packages\NPOI.2.5.1\lib\net45\NPOI.OOXML.dll
</HintPath>
</Reference>
<Reference
Include=
"NPOI.OpenXml4Net, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"
>
<HintPath>
..\
FunnyPick\
packages\NPOI.2.5.1\lib\net45\NPOI.OpenXml4Net.dll
</HintPath>
<HintPath>
..\packages\NPOI.2.5.1\lib\net45\NPOI.OpenXml4Net.dll
</HintPath>
</Reference>
<Reference
Include=
"NPOI.OpenXmlFormats, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"
>
<HintPath>
..\
FunnyPick\
packages\NPOI.2.5.1\lib\net45\NPOI.OpenXmlFormats.dll
</HintPath>
<HintPath>
..\packages\NPOI.2.5.1\lib\net45\NPOI.OpenXmlFormats.dll
</HintPath>
</Reference>
<Reference
Include=
"PresentationCore"
/>
<Reference
Include=
"PresentationFramework"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment