Skip to content

Commit e67af26

Browse files
committed
chore: Exteded AppendXmlDocSee and AppendXmlDocSeeAlso with href
1 parent dbb65a4 commit e67af26

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/NetEvolve.CodeBuilder/CSharpCodeBuilder.Documentation.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,32 +258,34 @@ public CSharpCodeBuilder AppendXmlDocExample(IEnumerable<string>? exampleLines)
258258
/// Appends an XML documentation see element for cross-references.
259259
/// </summary>
260260
/// <param name="cref">The cross-reference to another member or type.</param>
261+
/// <param name="isHRef">If set to <c>true</c>, uses 'href' instead of 'cref' for external links.</param>
261262
/// <returns>The current <see cref="CSharpCodeBuilder"/> instance to allow for method chaining.</returns>
262263
/// <remarks>If the cref is null or empty, the method returns without appending anything.</remarks>
263-
public CSharpCodeBuilder AppendXmlDocSee(string? cref)
264+
public CSharpCodeBuilder AppendXmlDocSee(string? cref, bool isHRef = false)
264265
{
265266
if (string.IsNullOrEmpty(cref))
266267
{
267268
return this;
268269
}
269270

270-
return EnsureNewLineForXmlDoc().AppendLine($"/// <see cref=\"{cref}\"/>");
271+
return EnsureNewLineForXmlDoc().AppendLine($"/// <see {(isHRef ? "href" : "cref")}=\"{cref}\"/>");
271272
}
272273

273274
/// <summary>
274275
/// Appends an XML documentation seealso element for see-also references.
275276
/// </summary>
276277
/// <param name="cref">The cross-reference to another member or type.</param>
278+
/// <param name="isHRef">If set to <c>true</c>, uses 'href' instead of 'cref' for external links.</param>
277279
/// <returns>The current <see cref="CSharpCodeBuilder"/> instance to allow for method chaining.</returns>
278280
/// <remarks>If the cref is null or empty, the method returns without appending anything.</remarks>
279-
public CSharpCodeBuilder AppendXmlDocSeeAlso(string? cref)
281+
public CSharpCodeBuilder AppendXmlDocSeeAlso(string? cref, bool isHRef = false)
280282
{
281283
if (string.IsNullOrEmpty(cref))
282284
{
283285
return this;
284286
}
285287

286-
return EnsureNewLineForXmlDoc().AppendLine($"/// <seealso cref=\"{cref}\"/>");
288+
return EnsureNewLineForXmlDoc().AppendLine($"/// <seealso {(isHRef ? "href" : "cref")}=\"{cref}\"/>");
287289
}
288290

289291
/// <summary>

0 commit comments

Comments
 (0)