Open
Conversation
… and at the end of the build reports the repeated document titles.
Mpdreamz
requested changes
Oct 13, 2025
| markdownExporters.Add(new ElasticsearchMarkdownSemanticExporter(logFactory, context.Collector, indexNamespace, context.Endpoints)); | ||
| if (exportOptions.Contains(Exporter.ElasticsearchNoSemantic)) | ||
| markdownExporters.Add(new ElasticsearchMarkdownExporter(logFactory, context.Collector, indexNamespace, context.Endpoints)); | ||
| markdownExporters.Add(new MarkdownValidationExporter()); |
Member
There was a problem hiding this comment.
Suggested change
| markdownExporters.Add(new MarkdownValidationExporter()); | |
| markdownExporters.Add(new MarkdownValidationExporter(context.Collector)); |
|
|
||
| namespace Elastic.Markdown.Exporters; | ||
|
|
||
| public class MarkdownValidationExporter : IMarkdownExporter |
Member
There was a problem hiding this comment.
Suggested change
| public class MarkdownValidationExporter : IMarkdownExporter | |
| public class MarkdownValidationExporter(IDiagnosticsCollector collector) : IMarkdownExporter |
| { | ||
| var title = kv.Key; | ||
| var filePaths = string.Join(", ", files.Select(f => f.FilePath)); | ||
| Console.WriteLine($"Error: Title '{title}' is used in multiple files: {filePaths}"); |
Member
There was a problem hiding this comment.
Suggested change
| Console.WriteLine($"Error: Title '{title}' is used in multiple files: {filePaths}"); | |
| collector.EmitError(filePaths.First(), $"Title '{title}' is used in multiple files: {filePaths}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a Markdown validation exporter. It collects the document titles and at the end of the build reports the repeated document titles.
This PR is not complete. It currently reports the repeated document titles by writing to the console. The StopAsync() method of an exporter doesn't have access to a build context to report the errors to the build.