From fc58dcd8f59c0b26bc5b2a991e9724d3e9d242a4 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 19 May 2026 16:41:26 +0200 Subject: [PATCH] Fix inline callout regex and li rendering for markdown links The MathInlineAnnotation regex excluded `/` from callout text, breaking link syntax like `[link](path/to/file.md)`. Also fix the inline annotation renderer to emit `
  • ` and content without an intermediate newline so the HTML structure matches what tests assert. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs | 2 +- .../Myst/CodeBlocks/EnhancedCodeBlockHtmlRenderer.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs b/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs index 5864c55dd4..b1fcb9fb2d 100644 --- a/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs +++ b/src/Elastic.Markdown/Myst/CodeBlocks/CallOutParser.cs @@ -11,6 +11,6 @@ public static partial class CallOutParser [GeneratedRegex(@"^.+\S+.*?\s<\d+>$", RegexOptions.IgnoreCase, 2000)] public static partial Regex CallOutNumber(); - [GeneratedRegex(@"^.+\S+.*?\s(?:\/\/|#)\s[^""\/#]+$", RegexOptions.IgnoreCase, 2000)] + [GeneratedRegex(@"^.+\S+.*?\s(?:\/\/|#)\s[^""#]+$", RegexOptions.IgnoreCase, 2000)] public static partial Regex MathInlineAnnotation(); } diff --git a/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockHtmlRenderer.cs b/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockHtmlRenderer.cs index 4adf9f9d14..1af15968e6 100644 --- a/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockHtmlRenderer.cs +++ b/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockHtmlRenderer.cs @@ -239,8 +239,8 @@ protected override void Write(HtmlRenderer renderer, EnhancedCodeBlock block) _ = renderer.WriteLine("
      "); foreach (var c in block.UniqueCallOuts) { - _ = renderer.WriteLine("
    1. "); - _ = renderer.WriteLine(RenderCalloutMarkdown(block, c).Value ?? string.Empty); + _ = renderer.Write("
    2. "); + _ = renderer.Write(RenderCalloutMarkdown(block, c).Value ?? string.Empty); _ = renderer.WriteLine("
    3. "); }