Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aspire/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using ConsoleAppFramework;
using Elastic.Documentation;
using Elastic.Documentation.Configuration;
using Microsoft.Extensions.Logging;
using static Elastic.Documentation.Aspire.ResourceNames;

Expand All @@ -29,6 +28,7 @@
return;

// ReSharper disable once RedundantLambdaParameterType
// ReSharper disable once VariableHidesOuterVariable
async Task BuildAspireHost(bool startElasticsearch, bool assumeCloned, bool skipPrivateRepositories, Cancel ctx)
{
var builder = DistributedApplication.CreateBuilder(args);
Expand Down
3 changes: 0 additions & 3 deletions src/Elastic.ApiExplorer/Endpoints/IndexViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using Elastic.ApiExplorer.Landing;
using Elastic.Documentation;

namespace Elastic.ApiExplorer.Endpoints;

public class IndexViewModel(ApiRenderContext context) : ApiViewModel(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ private static TRepository RepositoryDefaults<TRepository>(TRepository r, string
};
// ensure we always null path if we are running in CI
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CI")))
repository = repository with
{
Path = null
};
repository = repository with { Path = null };

if (string.IsNullOrEmpty(repository.Origin))
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("GITHUB_ACTIONS")))
Expand Down Expand Up @@ -149,10 +147,8 @@ public ContentSourceMatch Match(string repository, string branchOrTag)
var next = r.GetBranch(ContentSource.Next);
var isVersionBranch = ContentSourceRegex.MatchVersionBranch().IsMatch(branchOrTag);
if (current == branchOrTag)
match = match with
{
Current = ContentSource.Current
};
match = match with { Current = ContentSource.Current };

if (next == branchOrTag)
match = match with
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Collections;
using System.Runtime.Serialization;
using YamlDotNet.Serialization;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Elastic.Documentation.Configuration.Assembler;
using Microsoft.Extensions.DependencyInjection;
using NetEscapades.EnumGenerators;
using YamlDotNet.RepresentationModel;

namespace Elastic.Documentation.Configuration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using Elastic.Documentation.Configuration.Assembler;
using Elastic.Documentation.Configuration.Versions;
using YamlDotNet.RepresentationModel;
using YamlDotNet.Serialization;

namespace Elastic.Documentation.Configuration.Serialization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.IO.Abstractions;
using Elastic.Documentation.Configuration.Serialization;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
Expand Down
5 changes: 2 additions & 3 deletions src/Elastic.Documentation.ServiceDefaults/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
using OpenTelemetry.Logs;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;

Expand Down Expand Up @@ -57,9 +56,9 @@ public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) w
.WithTracing(tracing =>
{
_ = tracing.AddSource(builder.Environment.ApplicationName)
.AddAspNetCoreInstrumentation(tracing =>
.AddAspNetCoreInstrumentation(instrumentation =>
// Exclude health check requests from tracing
tracing.Filter = context =>
instrumentation.Filter = context =>
!context.Request.Path.StartsWithSegments(HealthEndpointPath)
&& !context.Request.Path.StartsWithSegments(AlivenessEndpointPath)
)
Expand Down
3 changes: 0 additions & 3 deletions src/Elastic.Documentation.Site/Htmx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Reflection;
using System.Text;
using System.Text.Encodings.Web;
using Elastic.Documentation.Extensions;

namespace Elastic.Documentation.Site;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@using Elastic.Documentation.Configuration.Builder
@inherits RazorSlice<Elastic.Documentation.Site.GlobalLayoutViewModel>
<nav id="secondary-nav" hx-disable="true" class="bg-grey-10 border-t-1 border-grey-20 font-sans font-semibold text-sm text-ink-light md:text-base">
<div class="max-w-(--max-layout-width) flex mx-auto justify-between items-center p-6">
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Documentation/AppliesTo/ApplicableTo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information

using System.Collections;
using System.Text.Json;
using System.Text.Json.Serialization;
using Elastic.Documentation.Diagnostics;
using YamlDotNet.Serialization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Collections;
using System.Text.Json.Serialization;
using Elastic.Documentation.AppliesTo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Collections.Frozen;
using System.Text.Json.Serialization;
using Elastic.Documentation.AppliesTo;
using Elastic.Documentation.Links;
Expand Down
3 changes: 0 additions & 3 deletions src/Elastic.Markdown/DocumentationGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
using Elastic.Documentation.Site.Navigation;
using Elastic.Documentation.State;
using Elastic.Markdown.Exporters;
using Elastic.Markdown.Helpers;
using Elastic.Markdown.IO;
using Elastic.Markdown.Links.CrossLinks;
using Elastic.Markdown.Myst.Renderers;
using Elastic.Markdown.Myst.Renderers.LlmMarkdown;
using Markdig.Syntax;
using Microsoft.Extensions.Logging;

Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Markdown/Exporters/LlmMarkdownExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Elastic.Documentation.Configuration;
using Elastic.Documentation.Configuration.Builder;
using Elastic.Markdown.Helpers;
using Elastic.Markdown.Myst.Renderers.LlmMarkdown;
using Markdig.Syntax;

namespace Elastic.Markdown.Exporters;
Expand Down
6 changes: 1 addition & 5 deletions src/Elastic.Markdown/Helpers/Interpolation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
// See the LICENSE file in the project root for more information

using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using System.Text.RegularExpressions;
using Elastic.Documentation;
using Elastic.Documentation.Diagnostics;
using Elastic.Markdown.Myst;
using Elastic.Markdown.Myst.InlineParsers.Substitution;
Expand Down Expand Up @@ -79,11 +77,9 @@ private static bool ReplaceSubstitutions(
{
if (lookup.TryGetValue(cleanKey, out var value))
{
// Apply mutations if present using shared utility
// Apply mutations if present using a shared utility
if (mutations.Length > 0)
{
value = SubstitutionMutationHelper.ApplyMutations(value, mutations);
}

collector?.CollectUsedSubstitutionKey(cleanKey);

Expand Down
3 changes: 0 additions & 3 deletions src/Elastic.Markdown/HtmlWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
using System.IO.Abstractions;
using Elastic.Documentation;
using Elastic.Documentation.Configuration.Builder;
using Elastic.Documentation.Extensions;
using Elastic.Documentation.Legacy;
using Elastic.Documentation.Site.FileProviders;
using Elastic.Documentation.Site.Navigation;
using Elastic.Markdown.Extensions.DetectionRules;
using Elastic.Markdown.IO;
using Elastic.Markdown.Myst.Renderers;
using Elastic.Markdown.Myst.Renderers.LlmMarkdown;
using Elastic.Markdown.Page;
using Markdig.Syntax;
using RazorSlices;
Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Markdown/IO/DocumentationFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
using System.IO.Abstractions;
using Elastic.Documentation.Site;
using Elastic.Markdown.Myst;
using Elastic.Markdown.Myst.FrontMatter;

Expand Down
4 changes: 0 additions & 4 deletions src/Elastic.Markdown/IO/MarkdownFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Elastic.Documentation.Configuration;
using Elastic.Documentation.Diagnostics;
using Elastic.Documentation.Navigation;
using Elastic.Documentation.Site;
using Elastic.Documentation.Site.Navigation;
using Elastic.Markdown.Helpers;
using Elastic.Markdown.Links.CrossLinks;
Expand All @@ -19,7 +18,6 @@
using Elastic.Markdown.Myst.InlineParsers;
using Markdig;
using Markdig.Extensions.Yaml;
using Markdig.Renderers.Roundtrip;
using Markdig.Syntax;

namespace Elastic.Markdown.IO;
Expand Down Expand Up @@ -294,9 +292,7 @@ public static List<PageTocItem> GetAnchors(
var processedTitle = step.Title;
// Apply substitutions to step titles
if (subs.Count > 0 && processedTitle.AsSpan().ReplaceSubstitutions(subs, set.Context.Collector, out var replacement))
{
processedTitle = replacement;
}

return new
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information

using System.Diagnostics.CodeAnalysis;
using Elastic.Documentation.Configuration.TableOfContents;

namespace Elastic.Markdown.IO.Navigation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
using Elastic.Documentation.AppliesTo;
using Elastic.Markdown.Diagnostics;
using Elastic.Markdown.Helpers;
using Elastic.Markdown.Myst.Directives;
using Elastic.Markdown.Myst.Directives.AppliesTo;
using Elastic.Markdown.Myst.FrontMatter;
using Markdig.Helpers;
using Markdig.Parsers;
using Markdig.Syntax;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@using Elastic.Documentation
@using Elastic.Documentation.AppliesTo
@using Elastic.Documentation.Configuration.Versions
@using Elastic.Markdown.Myst.FrontMatter
@inherits RazorSlice<Elastic.Markdown.Myst.Components.ApplicableToViewModel>

@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using Elastic.Documentation.AppliesTo;
using Elastic.Documentation.Configuration.Versions;
using Elastic.Markdown.Myst.FrontMatter;

namespace Elastic.Markdown.Myst.Components;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using Elastic.Documentation.AppliesTo;
using Elastic.Markdown.Myst.CodeBlocks;
using Elastic.Markdown.Myst.FrontMatter;
using Markdig.Parsers;

namespace Elastic.Markdown.Myst.Directives.AppliesTo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Globalization;
using System.IO.Abstractions;
using Elastic.Markdown.Diagnostics;

namespace Elastic.Markdown.Myst.Directives.CsvInclude;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ private static IEnumerable<string[]> ReadWithSep(string filePath, string separat
{
var rowData = new string[row.ColCount];
for (var i = 0; i < row.ColCount; i++)
{
rowData[i] = row[i].ToString();
}
yield return rowData;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ private static byte[] Deflate(byte[] data, CompressionLevel? level = null)

#if NET6_0_OR_GREATER
using (var zlibStream = level.HasValue ? new ZLibStream(memStream, level.Value, true) : new ZLibStream(memStream, CompressionMode.Compress, true))
{
zlibStream.Write(data);
}
#else
// Reference: https://yal.cc/cs-deflatestream-zlib/#code

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System.Collections.Generic;
using System.Linq;
using Elastic.Markdown.Diagnostics;
using Elastic.Markdown.Myst;

namespace Elastic.Markdown.Myst.Directives.Image;

Expand All @@ -29,9 +25,7 @@ public override void FinalizeAndValidate(ParserContext context)
{
var validHeights = new[] { "none", "small", "medium" };
if (!validHeights.Contains(MaxHeight.ToLower()))
{
this.EmitWarning($"Invalid max-height value '{MaxHeight}'. Valid options are: none, small, medium. Defaulting to 'none'.");
}
}

// Process child image blocks directly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Text;
using Elastic.Documentation.Extensions;
using Elastic.Markdown.Myst.Directives.Image;

namespace Elastic.Markdown.Myst.Directives.Image;

public class ImageCarouselViewModel : DirectiveViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
// See the LICENSE file in the project root for more information

using Elastic.Markdown.Helpers;
using Elastic.Markdown.IO;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using Microsoft.AspNetCore.Html;

namespace Elastic.Markdown.Myst.Directives.Stepper;
Expand All @@ -32,7 +29,7 @@ public HtmlString RenderTitle()
{
MarkdownSourcePath = directiveBlock.CurrentFile,
YamlFrontMatter = yamlFrontMatter,
DocumentationFileLookup = (path) => null!,
DocumentationFileLookup = _ => null!,
CrossLinkResolver = null!
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using Elastic.Documentation.AppliesTo;
using Elastic.Documentation.Configuration.Builder;
using Elastic.Documentation.Site;
using YamlDotNet.Serialization;

namespace Elastic.Markdown.Myst.FrontMatter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System;
using System.Linq;
using System.Text.Json;
using Elastic.Documentation;

Expand Down Expand Up @@ -39,9 +37,7 @@ public static string ApplyMutations(string value, IReadOnlyCollection<Substituti
{
var result = value;
foreach (var mutation in mutations)
{
result = ApplySingleMutation(result, mutation);
}
return result;
}

Expand All @@ -58,9 +54,7 @@ public static string ApplyMutations(string value, string[] mutations)
{
var trimmedMutation = mutationStr.Trim();
if (SubstitutionMutationExtensions.TryParse(trimmedMutation, out var mutation, true, true))
{
result = ApplySingleMutation(result, mutation);
}
}
return result;
}
Expand Down
Loading
Loading