private void RenderInheritanceLevel(TypeReference typeReference, MDDocument md) { var typeDefinition = typeReference.Resolve(); if (typeDefinition.BaseType != null) { this.RenderInheritanceLevel(typeDefinition.BaseType, md); } var stringBuilder = new StringBuilder(); for (int i = 0; i < this.currInheritanceLevel; i++) { for (int j = 0; j < 8; j++) { stringBuilder.Append(SPACE); } } this.currInheritanceLevel++; md.AddElement(new MDText { Text = $"{stringBuilder.ToString()}{typeDefinition.FullName}", }); md.AddElement(new MDText { Text = $"{Environment.NewLine}{Environment.NewLine}", }); }
protected override void OnBeforeSyntax(MDDocument md) { md.AddElement(new MDH2 { Text = "Inheritance Hierarchy", }); this.RenderInheritanceLevel(this.TypeDocumentation.TypeDefinition, md); }
private void AddTables(TypeDocumentation type, MDDocument md) { var path = $"{this.rootName}/{type.FullName.Replace(".", "/")}"; this.AddTable("Constructors", $"{path}/Constructors", type.ConstructorDocumentations, md); this.AddTable("Properties", $"{path}/Properties", type.PropertyDocumentations, md); this.AddTable("Methods", $"{path}/Methods", type.MethodDocumentations, md); this.AddTable("Fields", $"{path}/Fields", type.FieldDocumentations, md); }
protected override void OnAfterSyntax(MDDocument md) { md.AddElement(new MDH5 { Text = "Parameters", }); foreach (var param in this.MethodDocumentation.ParameterDocumentations) { md.AddElement(new MDItalics { Text = param.Name, }); md.AddElement(new MDText { Text = $"{Environment.NewLine}{Environment.NewLine}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}", }); md.AddElement(new MDText { Text = $"Type: {param.TypeName}{Environment.NewLine}{Environment.NewLine}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}{SPACE}", }); md.AddElement(new MDText { Text = $"{param.Summary}{Environment.NewLine}{Environment.NewLine}", }); md.AddElement(new MDText { Text = $"{Environment.NewLine}", }); } md.AddElement(new MDH5 { Text = "Return Value", }); md.AddElement(new MDText { Text = $"Type: {this.MethodDocumentation.ReturnValueDocumentation.TypeName}{Environment.NewLine}{Environment.NewLine}", }); md.AddElement(new MDText { Text = $"{this.MethodDocumentation.ReturnValueDocumentation.Summary}{Environment.NewLine}{Environment.NewLine}", }); }
//Add and Update MDDocument public MDDocument AddandUpdateMDDocument(MDDocument document) { MDDocument documentAppeal = new MDDocument(); if (document.Id == 0) { documentAppeal = _MDDocument.AddData(document); } else { documentAppeal = _MDDocument.UpdateData(document); } return(documentAppeal); }
public string Generate() { var md = new MDDocument(); // Add the header. md.AddElement(new MDH1 { Text = this.GetHeader(), }); if (!string.IsNullOrEmpty(this.Documentation.Summary?.InnerText)) { md.AddElement(new MDQuote { Quote = this.Documentation.Summary?.InnerText?.Trim(), }); } md.AddElement(new MDBold { Text = "Namespace:", }); md.AddElement(new MDText { Text = $" {this.TypeDocumentation.Namespace}{Environment.NewLine}{Environment.NewLine}", }); md.AddElement(new MDBold { Text = "Assembly:", }); md.AddElement(new MDText { Text = $" {this.AssemblyDocumentation.Name} (in {this.AssemblyDocumentation.FileName}){Environment.NewLine}", }); this.OnBeforeSyntax(md); md.AddElement(new MDH2 { Text = "Syntax", }); md.AddElement(new MDCode { Code = this.Documentation.Declaration, Language = "csharp", }); this.OnAfterSyntax(md); this.OnBeforeRemarks(md); if (!string.IsNullOrWhiteSpace(this.Documentation.Remarks?.InnerText)) { md.AddElement(new MDH2 { Text = "Remarks", }); md.AddElement(new MDText { Text = this.Documentation.Remarks?.InnerText?.Trim(), }); } return(md.Generate()); }
protected virtual void OnBeforeSyntax(MDDocument md) { }
protected virtual void OnBeforeRemarks(MDDocument md) { }
protected virtual void OnAfterSyntax(MDDocument md) { }
public MDDocument AddandUpdateMDDocument(MDDocument documentr) { return(_MDDocumentService.AddandUpdateMDDocument(documentr)); }
protected override void OnBeforeRemarks(MDDocument md) { this.AddTables(this.TypeDocumentation, md); }
private void AddTable(string tableName, string path, IEnumerable <DocumentationBase> items, MDDocument md) { if (!items.Any()) { return; } md.AddElement(new MDH2 { Text = tableName, }); var table = new MDTable(); table.Header.Cells.Add(new MDText { Text = "Name", }); table.Header.Cells.Add(new MDText { Text = "Description", }); foreach (var item in items) { var row = new MDTableRow(); row.Cells.Add(new MDLink { Text = item.Name, Url = $"/{path}/{HttpUtility.UrlEncode(item.GetSafeName()).Replace("+", "%20")}.md", }); row.Cells.Add(new MDText { Text = item.Summary?.InnerText?.Trim(), }); table.Rows.Add(row); } md.AddElement(table); }