MarkdownGenerator
MarkdownGenerator copied to clipboard
markdown links broken under Github
The tool output produces files that have ".md" files that work well under Github but generated links are broken because of file extensions.
Example, produced output:
[`ClassDocs`](Namespace.Class#myanchor)
whereas it should produce:
[`ClassDocs`](Namespace.Class.md#myanchor)
Fix can be easily fixed by updating the following loop in Program.cs:43
foreach (var g in types.GroupBy(x => x.Namespace).OrderBy(x => x.Key))
{
if (!Directory.Exists(dest)) Directory.CreateDirectory(dest);
homeBuilder.HeaderWithLink(2, g.Key + ".md", g.Key + ".md");
homeBuilder.AppendLine();
var sb = new StringBuilder();
foreach (var item in g.OrderBy(x => x.Name))
{
homeBuilder.ListLink(MarkdownBuilder.MarkdownCodeQuote(item.BeautifyName), g.Key + ".md" + "#" + item.BeautifyName.Replace("<", "").Replace(">", "").Replace(",", "").Replace(" ", "-").ToLower());
sb.Append(item.ToString());
}
File.WriteAllText(Path.Combine(dest, g.Key + ".md"), sb.ToString());
homeBuilder.AppendLine();
}