Fix standalone HTML and LaTeX exports

This commit is contained in:
Peer Hogeterp committed 2026-09-22 15:11:45 +02:00
1 parent c95cc5bacc
commit a1d8169284
3 files changed
+71 -3

No files matched your search

@@ -732,7 +732,13 @@ public partial class ContentBlockComponent : MSGComponentBase
// here which would fall out of sync with the one in FileExportFormatExtensions.
//
if (format.UsesPandoc())
await PandocExport.ToDocument(this.RustService, this.PandocAvailability, this.EffectiveExportTitle, format, this.Content);
{
if (this.Content.TryGetMarkdownText(out var originalMarkdown) &&
PlainFileExport.TryExtractStandaloneSource(originalMarkdown, format, out var source))
await PlainFileExport.ToSourceFile(this.RustService, this.EffectiveExportTitle, format, source);
else
await PandocExport.ToDocument(this.RustService, this.PandocAvailability, this.EffectiveExportTitle, format, this.Content);
}
else if (this.Content.TryGetExportMarkdown(out var markdown))
await PlainFileExport.ToFile(this.RustService, this.EffectiveExportTitle, format, markdown);
}
@@ -852,4 +858,4 @@ public partial class ContentBlockComponent : MSGComponentBase
await this.DisposeMathContainerIfNeededAsync();
}
}
}