From e0aa88248774d9948fe4c6598fee6805d69a56d4 Mon Sep 17 00:00:00 2001 From: Macka Date: Sat, 29 Nov 2025 14:53:27 +1000 Subject: [PATCH] Improve Markdown rendering for cref references Enhances handling of cref references by rendering them as inline code without Member Type when `text` not is provided, or as empty text if neither the text nor `crefAttribute` are valid. --- src/XMLDoc2Markdown/TypeDocumentation.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/XMLDoc2Markdown/TypeDocumentation.cs b/src/XMLDoc2Markdown/TypeDocumentation.cs index e2f8a0e..10959f2 100644 --- a/src/XMLDoc2Markdown/TypeDocumentation.cs +++ b/src/XMLDoc2Markdown/TypeDocumentation.cs @@ -679,7 +679,13 @@ private bool WriteExample(MemberInfo memberInfo) noPrefix: this.options.GitlabWiki); } - return new MarkdownText(text ?? crefAttribute); + if (!string.IsNullOrWhiteSpace(text)) + return new MarkdownText(text); + + if (!string.IsNullOrWhiteSpace(crefAttribute) && crefAttribute.Length > 2) + return new MarkdownInlineCode(crefAttribute[2..]); + + return new MarkdownText(string.Empty); } private bool TryGetMemberInfoFromReference(string? crefAttribute, out MemberInfo? memberInfo)