CommonMark.NET

This commit is contained in:
2024-09-16 14:40:52 -07:00
parent 11293968b8
commit c6c2ff6960
4 changed files with 19 additions and 2 deletions

View File

@ -325,7 +325,11 @@ public class FileRead : Shared.FileRead, IFileRead
private static void WriteMarkdownFile(FileConnectorConfiguration fileConnectorConfiguration, string[] alternateTargetFolders, ReadOnlyCollection<WorkItem> workItems, ReadOnlyCollection<string> workItemTypes)
{
string old;
string html;
string text;
string json;
string checkFile;
string? pathRoot;
List<char> spaces = new();
List<string> lines = new();
@ -356,7 +360,16 @@ public class FileRead : Shared.FileRead, IFileRead
foreach (string workItemType in workItemTypes)
{
AppendLines(spaces, lines, workItemAndChildren, workItemType);
File.WriteAllText(Path.Combine(alternateTargetFolder, $"{workItemType}.md"), string.Join(Environment.NewLine, lines));
checkFile = Path.Combine(alternateTargetFolder, $"{workItemType}.md");
text = string.Join(Environment.NewLine, lines);
old = !File.Exists(checkFile) ? string.Empty : File.ReadAllText(checkFile);
if (text != old)
File.WriteAllText(checkFile, text);
checkFile = Path.Combine(alternateTargetFolder, $"{workItemType}.html");
html = CommonMark.CommonMarkConverter.Convert(text);
old = !File.Exists(checkFile) ? string.Empty : File.ReadAllText(checkFile);
if (html != old)
File.WriteAllText(checkFile, html);
}
}
}