Skip to content
Merged
Changes from all commits
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
5 changes: 5 additions & 0 deletions src/Elastic.Markdown/Myst/MarkdownParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ public static MarkdownPipeline Pipeline
/// </summary>
private static string PreprocessLinkSubstitutions(string markdown, ParserContext context)
{
// The callback only rewrites links whose URL contains {{ }}. If the document
// has no {{ at all, both GetCodeBlockRanges and the Regex.Replace are pure overhead.
if (!markdown.Contains("{{", StringComparison.Ordinal))
return markdown;

// Find all code block boundaries to avoid processing links inside subs=false blocks
var codeBlockRanges = GetCodeBlockRanges(markdown);

Expand Down
Loading