From 1c99a917f9025772c8f782c15755659f0139cacb Mon Sep 17 00:00:00 2001 From: unknown <1463567152@qq.com> Date: Sat, 11 Jul 2026 23:06:33 +0800 Subject: [PATCH] =?UTF-8?q?markdown=E9=93=BE=E6=8E=A5=E8=BD=AC=E4=B9=89?= =?UTF-8?q?=E6=8B=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DocSharp.Common/Writers/MarkdownStringWriter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DocSharp.Common/Writers/MarkdownStringWriter.cs b/src/DocSharp.Common/Writers/MarkdownStringWriter.cs index 3a836fe..c12b773 100644 --- a/src/DocSharp.Common/Writers/MarkdownStringWriter.cs +++ b/src/DocSharp.Common/Writers/MarkdownStringWriter.cs @@ -114,6 +114,8 @@ public void WriteHyperlink(string displayText, string target, bool isAnchor, str else // Microsoft Word usually escapes spaces in the relationship, but we ensure it here. target = target.Replace(" ", "%20"); + // Escape parentheses to avoid breaking markdown link syntax: [text](url) + target = target.Replace("(", "%28").Replace(")", "%29"); Write($"[{displayText}]({target}"); if (!string.IsNullOrWhiteSpace(tooltip))