public List <Snippet> FromText(string contents) { using (var stringReader = new StringReader(contents)) { return(FileSnippetExtractor.Read(stringReader, "path.cs").ToList()); } }
public async Task Run() { var root = GitRepoDirectoryFinder.FindForFilePath(); var finder = new FileFinder(); var addinPath = Path.Combine(root, "BasicFodyAddin"); var snippetSourceFiles = finder.FindFiles( Path.Combine(root, "src/Docs"), addinPath); var snippets = FileSnippetExtractor.Read(snippetSourceFiles).ToList(); await snippets.AppendUrlsAsSnippets( "https://raw.githubusercontent.com/Fody/Fody/master/FodyPackaging/Weaver.props", "https://raw.githubusercontent.com/Fody/Fody/master/FodyPackaging/build/FodyPackaging.props", "https://raw.githubusercontent.com/Fody/Fody/master/FodyPackaging/build/FodyPackaging.targets"); var pagesDir = Path.Combine(root, "pages"); PurgeDirectory(pagesDir); var markdownProcessor = new DirectoryMarkdownProcessor(root); markdownProcessor.IncludeSnippets(snippets); markdownProcessor.Run(); }
public async Task Run() { var root = GitRepoDirectoryFinder.FindForFilePath(); var finder = new FileFinder(); var addinPath = Path.Combine(root, "BasicFodyAddin"); var snippetSourceFiles = finder.FindFiles( Path.Combine(root, "src/Docs"), addinPath); var snippets = FileSnippetExtractor.Read(snippetSourceFiles).ToList(); await snippets.AppendUrlsAsSnippets( "https://raw.githubusercontent.com/Fody/Fody/master/FodyPackaging/Weaver.props", "https://raw.githubusercontent.com/Fody/Fody/master/FodyPackaging/build/FodyPackaging.props", "https://raw.githubusercontent.com/Fody/Fody/master/FodyPackaging/build/FodyPackaging.targets"); var handling = new GitHubSnippetMarkdownHandling(root); var processor = new MarkdownProcessor(snippets, handling.AppendGroup, snippetSourceFiles); var sourceMdFiles = Directory.EnumerateFiles(Path.Combine(root, "pages/source"), "*.md"); var pagesDir = Path.Combine(root, "pages"); PurgeDirectory(pagesDir); foreach (var sourceFile in sourceMdFiles) { ProcessFile(sourceFile, processor, pagesDir); } }
void ReadingFiles() { #region ReadingFilesSimple var files = Directory.EnumerateFiles(@"C:\path", "*.cs", SearchOption.AllDirectories); var snippets = FileSnippetExtractor.Read(files); #endregion }
static List <Snippet> FromText(string contents) { using StringReader reader = new(contents); return(FileSnippetExtractor.Read(reader, "path.cs", 80).ToList()); }