public override void BuildDocs(string outputPath) { outputPath = DocUtilities.ChangeExtension(outputPath, "md"); // Write markdown file using (var writer = new MarkdownWriter(outputPath)) { foreach (var type in Library.ExportedTypes.Where(t => !t.Name.StartsWith("_")).OrderBy(t => t.Name)) { // Pull XML docs for type var typeDocs = Docs[ID.GetIDString(type)]; // Header, e.g. "StringBuilder class (System)" writer.WriteHeader(2, DocUtilities.GetTypeTitle(type, true), true); // Summary and other info PrintObsoleteWarning(type, writer); writer.WriteParagraph($"**Namespace:** {type.Namespace}"); writer.WriteParagraph($"**Inheritance:** {DocUtilities.GetInheritanceString(type)}", true); Summary(typeDocs, writer); // Signature writer.WriteCodeBlock(Lang, DocUtilities.GetClassSignature(type)); // Members WriteConstructors(type, writer); WriteProperties(type, writer); WriteIndexers(type, writer); WriteFields(type, writer); WriteMethods(type, writer); } } }
private void WriteParamList(int rank, MethodBase method, MarkdownWriter writer, MemberXmlDocs docs) { var plist = method.GetParameters(); if (method.ContainsGenericParameters) { if (method.IsGenericMethod) { var tplist = method.GetGenericArguments(); writer.WriteParagraph("**Type Parameters**"); for (int i = 0; i < tplist.Length; i++) { writer.WriteLine($"- `{tplist[i].Name}`: {TypeParam(docs, tplist[i].Name)}"); } } } if (plist.Length > 0) { writer.WriteParagraph("**Parameters**"); for (int i = 0; i < plist.Length; i++) { writer.WriteLine($"- `{plist[i].Name}`: {Param(docs, plist[i])}"); } } }
private static void Returns(int rank, MemberXmlDocs docs, MarkdownWriter writer) { var returns = docs?.Returns; if (!String.IsNullOrWhiteSpace(returns)) { writer.WriteHeader(rank, "Returns"); writer.WriteParagraph(returns); } }
private static void Summary(MemberXmlDocs docs, MarkdownWriter writer) => writer.WriteParagraph(docs?.Summary ?? "_No Summary_");