Skip to content

Commit d84ace3

Browse files
committed
register output file in output folder, we have to write it to both source and output folder though
1 parent b4c88de commit d84ace3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Elastic.Documentation.Configuration/Diagram/DiagramRegistry.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public async Task<int> CreateDiagramCachedFiles(Cancel ctx)
8383
if (directory != null && !_writeFileSystem.Directory.Exists(directory))
8484
_ = _writeFileSystem.Directory.CreateDirectory(directory);
8585

86+
_logger.LogWarning("Creating local diagram: {LocalPath}", localPath);
8687
// Download SVG content
8788
var svgContent = await _httpClient.GetStringAsync(diagramInfo.EncodedUrl, ct);
8889

src/Elastic.Markdown/Myst/Directives/Diagram/DiagramBlock.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ public override void FinalizeAndValidate(ParserContext context)
7272
// only register SVG if we can look up the Markdown
7373
if (context.DocumentationFileLookup(context.MarkdownSourcePath) is MarkdownFile currentMarkdown)
7474
{
75-
var path = context.Build.ReadFileSystem.FileInfo.New(Path.Combine(currentMarkdown.ScopeDirectory.FullName, localPath));
76-
context.DiagramRegistry.RegisterDiagramForCaching(path, EncodedUrl);
75+
var fs = context.Build.ReadFileSystem;
76+
var scopePath = fs.FileInfo.New(Path.Combine(currentMarkdown.ScopeDirectory.FullName, localPath));
77+
var relativeScopePath = fs.Path.GetRelativePath(context.Build.DocumentationSourceDirectory.FullName, scopePath.FullName);
78+
var outputPath = fs.FileInfo.New(Path.Combine(context.Build.DocumentationOutputDirectory.FullName, relativeScopePath));
79+
context.DiagramRegistry.RegisterDiagramForCaching(outputPath, EncodedUrl);
7780
}
7881
else
7982
this.EmitError($"Can not locate markdown source for {context.MarkdownSourcePath} to register diagram for caching.");

0 commit comments

Comments
 (0)