@@ -179,6 +179,40 @@ public async Task PagesCommand_IncludesLinkedMarkdownOutsideSourceRootRecursivel
179179 }
180180 }
181181
182+ [ TestMethod ]
183+ public async Task PagesCommand_DoesNotAbortOnInvalidYamlFrontmatter ( )
184+ {
185+ var tempRoot = CreateTempRoot ( ) ;
186+
187+ try
188+ {
189+ var sourceFolder = Path . Combine ( tempRoot , "source" ) ;
190+ var templateFolder = Path . Combine ( tempRoot , "template" ) ;
191+ var outputFolder = Path . Combine ( tempRoot , "output" ) ;
192+
193+ Directory . CreateDirectory ( sourceFolder ) ;
194+ Directory . CreateDirectory ( templateFolder ) ;
195+ Directory . CreateDirectory ( outputFolder ) ;
196+
197+ await File . WriteAllTextAsync ( Path . Combine ( sourceFolder , "bad-yaml.md" ) , "---\n title: \" C:\\ Projects\\ Atlas\" \n ---\n \n # Still renders" ) ;
198+ await File . WriteAllTextAsync ( Path . Combine ( templateFolder , "template.html" ) , "<html><body>{{ body }}</body></html>" ) ;
199+
200+ var exitCode = await new PagesCommand ( ) . InvokeAsync ( [
201+ "--markdown-folder" , sourceFolder ,
202+ "--template" , templateFolder ,
203+ "--output" , outputFolder ] ) ;
204+
205+ var generatedHtml = await File . ReadAllTextAsync ( Path . Combine ( outputFolder , "bad-yaml" , "index.html" ) ) ;
206+
207+ Assert . AreEqual ( 0 , exitCode ) ;
208+ StringAssert . Contains ( generatedHtml , "Still renders" ) ;
209+ }
210+ finally
211+ {
212+ DeleteTempRoot ( tempRoot ) ;
213+ }
214+ }
215+
182216 private static string CreateTempRoot ( )
183217 {
184218 var tempRoot = Path . Combine ( Path . GetTempPath ( ) , "wac-blog-tests" , Guid . NewGuid ( ) . ToString ( "N" ) ) ;
0 commit comments