Skip to content

Commit 383e6e6

Browse files
committed
dotnet format
1 parent 4f9979c commit 383e6e6

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/Elastic.Markdown/CrossLinks/ExternalLinksResolver.cs renamed to src/Elastic.Markdown/CrossLinks/CrossLinkResolver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Elastic.Markdown.CrossLinks;
1414
public interface ICrossLinkResolver
1515
{
1616
Task FetchLinks();
17-
bool TryResolve(Action<string> errorEmitter, Uri crossLinkUri, [NotNullWhen(true)]out Uri? resolvedUri);
17+
bool TryResolve(Action<string> errorEmitter, Uri crossLinkUri, [NotNullWhen(true)] out Uri? resolvedUri);
1818
}
1919

2020
public class CrossLinkResolver(ConfigurationFile configuration, ILoggerFactory logger) : ICrossLinkResolver
@@ -41,7 +41,7 @@ public async Task FetchLinks()
4141
_linkReferences = dictionary.ToFrozenDictionary();
4242
}
4343

44-
public bool TryResolve(Action<string> errorEmitter, Uri crossLinkUri, [NotNullWhen(true)]out Uri? resolvedUri) =>
44+
public bool TryResolve(Action<string> errorEmitter, Uri crossLinkUri, [NotNullWhen(true)] out Uri? resolvedUri) =>
4545
TryResolve(errorEmitter, _linkReferences, crossLinkUri, out resolvedUri);
4646

4747
private static Uri BaseUri { get; } = new Uri("https://docs-v3-preview.elastic.dev");

src/Elastic.Markdown/IO/State/LinkReference.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using System.ComponentModel;
65
using System.Text.Json.Serialization;
76
using Elastic.Markdown.IO.Discovery;
87

98
namespace Elastic.Markdown.IO.State;
109

1110
public record LinkMetadata
1211
{
13-
[JsonPropertyName("anchors" )]
12+
[JsonPropertyName("anchors")]
1413
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
1514
public string[]? Anchors { get; init; } = [];
1615

@@ -27,7 +26,7 @@ public record LinkReference
2726
[JsonPropertyName("url_path_prefix")]
2827
public required string? UrlPathPrefix { get; init; }
2928

30-
/// Mapping of relative filepath and all the page's anchors for deeplinks
29+
/// Mapping of relative filepath and all the page's anchors for deep links
3130
[JsonPropertyName("links")]
3231
public required Dictionary<string, LinkMetadata> Links { get; init; } = [];
3332

src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ public void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer) { }
3838

3939
internal partial class LinkRegexExtensions
4040
{
41-
4241
[GeneratedRegex(@"\s\=(?<width>\d+%?)(?:x(?<height>\d+%?))?$", RegexOptions.IgnoreCase, "en-US")]
4342
public static partial Regex MatchTitleStylingInstructions();
44-
4543
}
4644

4745
public class DiagnosticLinkInlineParser : LinkInlineParser
@@ -124,13 +122,15 @@ private bool ValidateBasicUrl(LinkInline link, InlineProcessor processor, string
124122
processor.EmitWarning(link, "Found empty url");
125123
return false;
126124
}
125+
127126
if (url.Contains("{{") || url.Contains("}}"))
128127
{
129128
processor.EmitWarning(link,
130129
"The url contains a template expression. Please do not use template expressions in links. " +
131130
"See https://github.com/elastic/docs-builder/issues/182 for further information.");
132131
return false;
133132
}
133+
134134
return true;
135135
}
136136

@@ -152,6 +152,7 @@ private bool ValidateExternalUri(LinkInline link, InlineProcessor processor, Par
152152
"to allow links to this domain."
153153
);
154154
}
155+
155156
return true;
156157
}
157158

@@ -205,7 +206,8 @@ private static void ProcessLinkText(InlineProcessor processor, LinkInline link,
205206

206207
if (markdown == null)
207208
{
208-
processor.EmitWarning(link, $"'{url}' could not be resolved to a markdown file while creating an auto text link, '{file.FullName}' does not exist.");
209+
processor.EmitWarning(link,
210+
$"'{url}' could not be resolved to a markdown file while creating an auto text link, '{file.FullName}' does not exist.");
209211
return;
210212
}
211213

@@ -261,7 +263,7 @@ private static string GetRootRelativePath(ParserContext context, IFileInfo file)
261263
return file.FullName.Replace(docsetDirectory!.FullName, string.Empty);
262264
}
263265

264-
private static bool IsCrossLink([NotNullWhen(true)]Uri? uri) =>
266+
private static bool IsCrossLink([NotNullWhen(true)] Uri? uri) =>
265267
uri != null // This means it's not a local
266268
&& !ExcludedSchemes.Contains(uri.Scheme)
267269
&& !uri.IsFile

tests/Elastic.Markdown.Tests/MockFileSystemExtensions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public static void GenerateDocSetYaml(this MockFileSystem fileSystem, IDirectory
1414
// language=yaml
1515
var yaml = new StringWriter();
1616
yaml.WriteLine("cross_links:");
17-
yaml.WriteLine(" - docs-content");
18-
yaml.WriteLine(" - kibana");
17+
yaml.WriteLine(" - docs-content");
18+
yaml.WriteLine(" - kibana");
1919
yaml.WriteLine("toc:");
2020
var markdownFiles = fileSystem.Directory
2121
.EnumerateFiles(root.FullName, "*.md", SearchOption.AllDirectories);
@@ -34,5 +34,4 @@ public static void GenerateDocSetYaml(this MockFileSystem fileSystem, IDirectory
3434

3535
fileSystem.AddFile(Path.Combine(root.FullName, "docset.yml"), new MockFileData(yaml.ToString()));
3636
}
37-
3837
}

0 commit comments

Comments
 (0)