@@ -15,21 +15,21 @@ namespace Elastic.Markdown.Exporters;
1515
1616public class LLMTextExporter : IMarkdownExporter
1717{
18- public ValueTask StartAsync ( CancellationToken ctx = default ) => ValueTask . CompletedTask ;
18+ public ValueTask StartAsync ( Cancel ctx = default ) => ValueTask . CompletedTask ;
1919
20- public ValueTask StopAsync ( CancellationToken ctx = default ) => ValueTask . CompletedTask ;
20+ public ValueTask StopAsync ( Cancel ctx = default ) => ValueTask . CompletedTask ;
2121
22- public ValueTask < bool > ExportAsync ( MarkdownExportContext context , CancellationToken ctx )
22+ public async ValueTask < bool > ExportAsync ( MarkdownExportContext context , Cancel ctx )
2323 {
2424 var source = context . File . SourceFile ;
25- var llmText = ToLLMText ( context . BuildContext , context . File . YamlFrontMatter , context . Resolvers , source ) ;
2625 var fs = source . FileSystem ;
26+ var llmText = context . LLMText ??= ToLLMText ( context . BuildContext , context . File . YamlFrontMatter , context . Resolvers , source ) ;
2727
28- //var llmText = context.LLMText ??= LLMRoundtripRenderer.ToLLMText(context.Document);
29- return ValueTask . FromResult ( true ) ;
28+ var newFile = fs . FileInfo . New ( Path . ChangeExtension ( source . FullName , ".md" ) ) ;
29+ await fs . File . WriteAllTextAsync ( newFile . FullName , llmText , ctx ) ;
30+ return true ;
3031 }
3132
32-
3333 public static string ToLLMText ( BuildContext buildContext , YamlFrontMatter ? frontMatter , IParserResolvers resolvers , IFileInfo source )
3434 {
3535 var fs = source . FileSystem ;
0 commit comments