/// <inheritdoc/> public string FormatToLink(TypeWithComment thisType, ConstructorInfoWithComment constructor, string?displayFormat = null, string?anchorFormat = null) { string?fmt = anchorFormat ?? ConstructorAnchorDefaultFormat; TypeWithComment declaringType = constructor.GetDeclaringTypeInfo(); if (object.Equals(thisType, declaringType) || constructor.Info.DeclaringType.IsAssignableFrom(thisType.Info) || declaringType.Comment.IsEmpty) { string anchor = constructor.Info.FormatToReadableSignature(); string displayText; if (string.IsNullOrEmpty(displayFormat)) { displayText = System.Web.HttpUtility.HtmlEncode(anchor); } else { displayText = ZString.Format(displayFormat, System.Web.HttpUtility.HtmlEncode(anchor)); } if (string.IsNullOrEmpty(fmt)) { return(ZString.Format("[{0}](#{1})", displayText, ToAnchor(anchor))); } else { return(ZString.Format("[{0}](#{1})", displayText, ToAnchor(ZString.Format(fmt, anchor)))); } } else { string anchor = ZString.Concat(declaringType.Info.FormatToReadableTypeName(false), ".", constructor.Info.FormatToReadableSignature()); string displayText; if (string.IsNullOrEmpty(displayFormat)) { displayText = System.Web.HttpUtility.HtmlEncode(anchor); } else { displayText = ZString.Format(displayFormat, System.Web.HttpUtility.HtmlEncode(anchor)); } string typeLink = ZString.Format("../{1}/{2}.md", FormatToReadableName(declaringType, false), declaringType.Namespace, declaringType.Name); if (string.IsNullOrEmpty(fmt)) { return(ZString.Format("[{0}]({1}#{2})", displayText, typeLink, ToAnchor(anchor))); } else { return(ZString.Format("[{0}]({1}#{2})", displayText, typeLink, ToAnchor(ZString.Format(fmt, anchor)))); } } }
/// <inheritdoc/> public string FormatToAnchor(ConstructorInfoWithComment constructor, string?format = null) { var fmt = format ?? ConstructorAnchorDefaultFormat; if (string.IsNullOrEmpty(fmt)) { return(FormatToReadableSignature(constructor)); } else { return(ZString.Format(fmt, FormatToReadableSignature(constructor))); } }
/// <inheritdoc/> public string FormatToReadableSignature(ConstructorInfoWithComment constructor) { return(System.Web.HttpUtility.HtmlEncode(constructor.Info.FormatToReadableSignature())); }