Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 src/Elastic.Markdown/IO/MarkdownFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public string? NavigationTitle
}

//indexed by slug
private readonly Dictionary<string, PageTocItem> _tableOfContent = new();
private readonly Dictionary<string, PageTocItem> _tableOfContent = new Dictionary<string, PageTocItem>(StringComparer.OrdinalIgnoreCase);
public IReadOnlyDictionary<string, PageTocItem> TableOfContents => _tableOfContent;

private readonly HashSet<string> _additionalLabels = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public override bool Match(InlineProcessor processor, ref StringSlice slice)
if (!string.IsNullOrEmpty(anchor))
{
if (markdown == null || (!markdown.TableOfContents.TryGetValue(anchor, out var heading)
&& !markdown.AdditionalLabels.Contains(anchor)))
&& !markdown.AdditionalLabels.Contains(anchor, StringComparer.OrdinalIgnoreCase)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mpdreamz What do you think about this?

What are additional labels actually?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are anchors discovered on the page. The property name is bad :)

Hashset supports a string comparer at creation time too.

new HashSet(StringComparer.OrdinalIgnoreCase);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processor.EmitError(line, column, length, $"`{anchor}` does not exist in {markdown?.FileName}.");

else if (link.FirstChild == null && heading != null)
Expand Down
Loading