Skip to content

Commit a774883

Browse files
authored
Merge branch 'main' into feature/fix-relative-links
2 parents dac0a61 + 689c4e5 commit a774883

File tree

16 files changed

+90
-25
lines changed

16 files changed

+90
-25
lines changed

.github/workflows/comment-on-asciidoc-changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
owner: context.repo.owner,
3737
repo: context.repo.repo,
3838
issue_number: context.payload.pull_request.number,
39-
body: 'It looks like this PR modifies one or more `.asciidoc` files. These files are being migrated to Markdown, and any changes merged now will be lost. See the [migration guide](https://elastic.github.io/docs-builder/migration/freeze/index.html) for details.'
39+
body: '> [!WARNING]\n> It looks like this PR modifies one or more `.asciidoc` files. These files are being migrated to Markdown, and any changes merged now will be lost. See the [migration guide](https://elastic.github.io/docs-builder/migration/freeze/index.html) for details.'
4040
})
4141
4242
- name: Error if .asciidoc files changed

docs/syntax/applies.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ Are equivalent, note `all` just means we won't be rendering the version portion
5252
## This section has its own applies annotations [#sections]
5353

5454
:::{applies}
55-
:stack: unavailable
56-
:serverless: tech-preview
57-
:cloud: ga
55+
:serverless: unavailable
5856
:::
5957

6058
:::{note}

src/Elastic.Markdown/DocumentationGenerator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public async Task GenerateAll(Cancel ctx)
7272

7373
await ExtractEmbeddedStaticResources(ctx);
7474

75-
7675
_logger.LogInformation($"Completing diagnostics channel");
7776
Context.Collector.Channel.TryComplete();
7877

@@ -92,6 +91,7 @@ private async Task ProcessDocumentationFiles(HashSet<string> offendingFiles, Dat
9291
{
9392
var processedFileCount = 0;
9493
var exceptionCount = 0;
94+
var totalFileCount = DocumentationSet.Files.Count;
9595
_ = Context.Collector.StartAsync(ctx);
9696
await Parallel.ForEachAsync(DocumentationSet.Files, ctx, async (file, token) =>
9797
{
@@ -112,8 +112,9 @@ await Parallel.ForEachAsync(DocumentationSet.Files, ctx, async (file, token) =>
112112
}
113113

114114
if (processedFiles % 100 == 0)
115-
_logger.LogInformation($"-> Handled {processedFiles} files");
115+
_logger.LogInformation($"-> Processed {processedFiles}/{totalFileCount} files");
116116
});
117+
_logger.LogInformation($"-> Processed {processedFileCount}/{totalFileCount} files");
117118
}
118119

119120
private async Task ExtractEmbeddedStaticResources(Cancel ctx)
@@ -149,7 +150,7 @@ private async Task ProcessFile(HashSet<string> offendingFiles, DocumentationFile
149150
return;
150151
}
151152

152-
_logger.LogTrace($"{file.SourceFile.FullName}");
153+
_logger.LogTrace($"--> {file.SourceFile.FullName}");
153154
var outputFile = OutputFile(file.RelativePath);
154155
if (file is MarkdownFile markdown)
155156
await HtmlWriter.WriteAsync(outputFile, markdown, token);

src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace Elastic.Markdown.Myst.CodeBlocks;
88

99
public static partial class CallOutParser
1010
{
11-
[GeneratedRegex(@"^.+\S+.*?\s<\d+>$", RegexOptions.IgnoreCase, "en-US")]
11+
[GeneratedRegex(@"^.+\S+.*?\s<\d+>$", RegexOptions.IgnoreCase, 2000, "en-US")]
1212
public static partial Regex CallOutNumber();
1313

14-
[GeneratedRegex(@"^.+\S+.*?\s(?:\/\/|#)\s[^""\/#]+$", RegexOptions.IgnoreCase, "en-US")]
14+
[GeneratedRegex(@"^.+\S+.*?\s(?:\/\/|#)\s[^""\/#]+$", RegexOptions.IgnoreCase, 2000, "en-US")]
1515
public static partial Regex MathInlineAnnotation();
1616
}

src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public override bool Close(BlockProcessor processor, Block block)
119119
continue;
120120

121121
List<CallOut> callOuts = [];
122-
var hasClassicCallout = span.IndexOf("<") > 0;
122+
var hasClassicCallout = span.IndexOf("<") > 0 && span.LastIndexOf(">") == span.Length - 1;
123123
if (hasClassicCallout)
124124
{
125125
var matchClassicCallout = CallOutParser.CallOutNumber().EnumerateMatches(span);

src/Elastic.Markdown/Myst/Comments/CommentBlockParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public override bool Close(BlockProcessor processor, Block block)
155155
{
156156
if (!processor.TrackTrivia)
157157
{
158-
var heading = (HeadingBlock)block;
158+
var heading = (CommentBlock)block;
159159
heading.Lines.Trim();
160160
}
161161

src/Elastic.Markdown/Myst/MarkdownParser.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public static MarkdownPipeline Pipeline
6060
return _pipeline;
6161

6262
var builder = new MarkdownPipelineBuilder()
63-
.EnableTrackTrivia()
6463
.UseInlineAnchors()
6564
.UsePreciseSourceLocation()
6665
.UseDiagnosticLinks()

src/Elastic.Markdown/Slices/HtmlWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public HtmlWriter(DocumentationSet documentationSet, IFileSystem writeFileSystem
2828
public ILoggerFactory LoggerFactory { get; }
2929
public ServiceProvider ServiceProvider { get; }
3030

31+
private Task<string> RenderEmptyString(MarkdownFile markdown, Cancel ctx = default) =>
32+
Task.FromResult(string.Empty);
33+
3134
private async Task<string> RenderNavigation(MarkdownFile markdown, Cancel ctx = default)
3235
{
3336
var slice = Layout._TocTree.Create(new NavigationViewModel

src/docs-assembler/Cli/Filters.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public override async Task InvokeAsync(ConsoleAppContext context, CancellationTo
4545
return;
4646
}
4747

48-
ConsoleApp.LogError(ex.ToString()); // .ToString() shows stacktrace, .Message can avoid showing stacktrace to user.
48+
throw;
49+
4950
}
5051
}
5152
}

src/docs-builder/Cli/Filters.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public override async Task InvokeAsync(ConsoleAppContext context, CancellationTo
4444
return;
4545
}
4646

47-
ConsoleApp.LogError(ex.ToString());
47+
throw;
48+
4849
}
4950
}
5051
}

0 commit comments

Comments
 (0)