Skip to content

Commit 35ef39e

Browse files
committed
ensure we lookup snippets anchored to the root
1 parent eac8a6d commit 35ef39e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Elastic.Markdown/IO/MarkdownFile.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ private void ReadDocumentInstructions(MarkdownDocument document)
200200
else if (Title.AsSpan().ReplaceSubstitutions(subs, out var replacement))
201201
Title = replacement;
202202

203+
if (RelativePath.Contains("esql-functions-operators"))
204+
{
205+
206+
}
203207
var toc = GetAnchors(_set, MarkdownParser, YamlFrontMatter, document, subs, out var anchors);
204208

205209
_tableOfContent.Clear();
@@ -225,7 +229,7 @@ public static List<PageTocItem> GetAnchors(
225229
var includes = includeBlocks
226230
.Select(i =>
227231
{
228-
var path = i.IncludePathRelative;
232+
var path = i.IncludePathFromSourceDirectory;
229233
if (path is null
230234
|| !set.FlatMappedFiles.TryGetValue(path, out var file)
231235
|| file is not SnippetFile snippet)

src/Elastic.Markdown/Myst/Directives/IncludeBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class IncludeBlock(DirectiveBlockParser parser, ParserContext context) :
3535
public YamlFrontMatter? FrontMatter { get; } = context.FrontMatter;
3636

3737
public string? IncludePath { get; private set; }
38-
public string? IncludePathRelative { get; private set; }
38+
public string? IncludePathFromSourceDirectory { get; private set; }
3939

4040
public bool Found { get; private set; }
4141

@@ -70,7 +70,7 @@ private void ExtractInclusionPath(ParserContext context)
7070
includeFrom = DocumentationSourcePath.FullName;
7171

7272
IncludePath = Path.Combine(includeFrom, includePath.TrimStart('/'));
73-
IncludePathRelative = Path.GetRelativePath(includeFrom, IncludePath);
73+
IncludePathFromSourceDirectory = Path.GetRelativePath(DocumentationSourcePath.FullName, IncludePath);
7474
if (FileSystem.File.Exists(IncludePath))
7575
Found = true;
7676
else

0 commit comments

Comments
 (0)