Skip to content

Commit 884c167

Browse files
committed
Update TocBuilder.cs
1 parent c4f474a commit 884c167

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/MarkdownSnippets/Processing/TocBuilder.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ static class TocBuilder
22
{
33
public static string BuildToc(List<Line> headerLines, int level, List<string> tocExcludes, string newLine)
44
{
5+
var excludesSet = new HashSet<string>(tocExcludes, StringComparer.OrdinalIgnoreCase);
56
var processed = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
67
var builder = new StringBuilder();
78
builder.Append("<!-- toc -->");
@@ -33,7 +34,7 @@ public static string BuildToc(List<Line> headerLines, int level, List<string> to
3334
}
3435

3536
var title = GetTitle(trimmedHash);
36-
if (tocExcludes.Any(_ => string.Equals(_, title, StringComparison.OrdinalIgnoreCase)))
37+
if (excludesSet.Contains(title))
3738
{
3839
continue;
3940
}

0 commit comments

Comments
 (0)