Skip to content

Commit 8a702d1

Browse files
committed
add inline anchors to additional labels on markdown file so they can be resolved
1 parent b6a9d74 commit 8a702d1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Elastic.Markdown/IO/MarkdownFile.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Elastic.Markdown.Myst;
99
using Elastic.Markdown.Myst.Directives;
1010
using Elastic.Markdown.Myst.FrontMatter;
11+
using Elastic.Markdown.Myst.InlineParsers;
1112
using Elastic.Markdown.Slices;
1213
using Markdig;
1314
using Markdig.Extensions.Yaml;
@@ -149,8 +150,6 @@ private void ReadDocumentInstructions(MarkdownDocument document)
149150
Collector.EmitWarning(FilePath, "Document has no title, using file name as title.");
150151
}
151152

152-
153-
154153
var contents = document
155154
.Where(block => block is HeadingBlock { Level: >= 2 })
156155
.Cast<HeadingBlock>()
@@ -169,7 +168,9 @@ private void ReadDocumentInstructions(MarkdownDocument document)
169168
.Select(b => b.CrossReferenceName)
170169
.Where(l => !string.IsNullOrWhiteSpace(l))
171170
.Select(s => s.Slugify())
171+
.Concat(document.Descendants<InlineAnchor>().Select(a=>a.Anchor))
172172
.ToArray();
173+
173174
foreach (var label in labels)
174175
{
175176
if (!string.IsNullOrEmpty(label))

0 commit comments

Comments
 (0)