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))