csharpdeeb25a2 | 1 | using CascadeIDE.Contracts; |
| 2 | using CascadeIDE.Services; |
| 3 | |
| 4 | namespace CascadeIDE.Features.Markdown.Application; |
| 5 | |
| 6 | /// <summary>Развернуть include в Markdown и записать файл (без UI).</summary> |
| 7 | [ComputingUnit("markdown-expand-export")] |
| 8 | public static class ExpandedMarkdownFileExportProjection |
| 9 | { |
| 10 | public readonly record struct WriteOutcome(bool Ok, string? ErrorMessage); |
| 11 | |
| 12 | public static WriteOutcome TryExpandAndWriteAllText(string sourceMarkdownPath, string rawMarkdown, string outputPath) |
| 13 | { |
| 14 | try |
| 15 | { |
| 16 | var expanded = MarkdownIncludeExpansion.ExpandMarkdown(rawMarkdown, sourceMarkdownPath); |
| 17 | File.WriteAllText(outputPath, expanded); |
| 18 | return new WriteOutcome(true, null); |
| 19 | } |
| 20 | catch (IncludeExpansionException iex) |
| 21 | { |
| 22 | return new WriteOutcome(false, iex.Message); |
| 23 | } |
| 24 | catch (Exception ex) |
| 25 | { |
| 26 | return new WriteOutcome(false, ex.Message); |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
View only · write via MCP/CIDE