From ab9c02ecb900770c426b70b0295f01869bdfc632 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Mon, 31 Mar 2025 14:06:45 +0200 Subject: [PATCH 1/2] Only filter out detection rules that are within an '_deprecated' folder --- .../DetectionRules/DetectionRulesDocsBuilderExtension.cs | 2 +- .../Myst/InlineParsers/DiagnosticLinkInlineParser.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Elastic.Markdown/Extensions/DetectionRules/DetectionRulesDocsBuilderExtension.cs b/src/Elastic.Markdown/Extensions/DetectionRules/DetectionRulesDocsBuilderExtension.cs index 90630d093..66d29a176 100644 --- a/src/Elastic.Markdown/Extensions/DetectionRules/DetectionRulesDocsBuilderExtension.cs +++ b/src/Elastic.Markdown/Extensions/DetectionRules/DetectionRulesDocsBuilderExtension.cs @@ -124,7 +124,7 @@ private IReadOnlyCollection ReadDetectionRuleFolder(ConfigurationFile .Where(f => !f.Directory!.Attributes.HasFlag(FileAttributes.Hidden) && !f.Directory!.Attributes.HasFlag(FileAttributes.System)) .Where(f => f.Extension is ".md" or ".toml") .Where(f => f.Name != "README.md") - .Where(f => !f.FullName.Contains("_deprecated")) + .Where(f => !f.FullName.Contains($"{Path.DirectorySeparatorChar}_deprecated{Path.DirectorySeparatorChar}")) .Select(f => { var relativePath = Path.GetRelativePath(sourceDirectory.FullName, f.FullName); diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs index 29362dfc9..bc90107f8 100644 --- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs +++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs @@ -309,7 +309,7 @@ private static void UpdateLinkUrl(LinkInline link, string url, ParserContext con // './' current path lookups should be relative to sub-path. // If it's not e.g /reference/cloud-k8s/api-docs/ these links should resolve on folder up. var siblingsGoToCurrent = url.StartsWith("./") && markdownPath == "index.md"; - if (!siblingsGoToCurrent) + if (!siblingsGoToCurrent && subPrefix.LastIndexOf('/') >= 0) subPrefix = subPrefix[..subPrefix.LastIndexOf('/')]; var combined = '/' + Path.Combine(subPrefix, url).TrimStart('/'); From 96a5272dcf9b48b4eae5665de33f82fd293d51d7 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Mon, 31 Mar 2025 14:08:47 +0200 Subject: [PATCH 2/2] Revert unintented change --- .../Myst/InlineParsers/DiagnosticLinkInlineParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs index bc90107f8..29362dfc9 100644 --- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs +++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs @@ -309,7 +309,7 @@ private static void UpdateLinkUrl(LinkInline link, string url, ParserContext con // './' current path lookups should be relative to sub-path. // If it's not e.g /reference/cloud-k8s/api-docs/ these links should resolve on folder up. var siblingsGoToCurrent = url.StartsWith("./") && markdownPath == "index.md"; - if (!siblingsGoToCurrent && subPrefix.LastIndexOf('/') >= 0) + if (!siblingsGoToCurrent) subPrefix = subPrefix[..subPrefix.LastIndexOf('/')]; var combined = '/' + Path.Combine(subPrefix, url).TrimStart('/');