diff --git a/docs/testing/index.md b/docs/testing/index.md index 3265aea28..d17fecb60 100644 --- a/docs/testing/index.md +++ b/docs/testing/index.md @@ -30,4 +30,4 @@ The files in this directory are used for testing purposes. Do not edit these fil { "key": "value" } - ``` \ No newline at end of file + ``` diff --git a/src/Elastic.Markdown/Assets/markdown/code.css b/src/Elastic.Markdown/Assets/markdown/code.css index b01ef22dd..dfd0bbd46 100644 --- a/src/Elastic.Markdown/Assets/markdown/code.css +++ b/src/Elastic.Markdown/Assets/markdown/code.css @@ -27,7 +27,8 @@ } } - pre code .code-callout .hljs-number { + pre code .code-callout { + @apply ml-1; transform: translateY(-1px); user-select: none; } @@ -47,8 +48,12 @@ left: calc(-1 * var(--spacing) * 6); } } + + pre code .code-callout .hljs-number { + @apply text-white!; + } - pre code .code-callout .hljs-number, + pre code .code-callout, ol.code-callouts li::before { @apply text-xs! text-white! diff --git a/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs b/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs index cb69b373d..82e376420 100644 --- a/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs +++ b/src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs @@ -238,7 +238,7 @@ private static List EnumerateAnnotations(Regex.ValueMatchEnumerator mat private static CallOut? ParseMagicCallout(ValueMatch match, ref ReadOnlySpan span, ref int callOutIndex, int originatingLine) { - var startIndex = Math.Max(span.LastIndexOf("//"), span.LastIndexOf('#')); + var startIndex = Math.Max(span.LastIndexOf(" // "), span.LastIndexOf(" # ")); if (startIndex <= 0) return null; @@ -248,7 +248,7 @@ private static List EnumerateAnnotations(Regex.ValueMatchEnumerator mat return new CallOut { Index = callOutIndex, - Text = callout.TrimStart('/').TrimStart('#').TrimStart().ToString(), + Text = callout.TrimStart().TrimStart('/').TrimStart('#').TrimStart().ToString(), InlineCodeAnnotation = true, SliceStart = startIndex, Line = originatingLine, @@ -257,7 +257,7 @@ private static List EnumerateAnnotations(Regex.ValueMatchEnumerator mat private static List ParseClassicCallOuts(ValueMatch match, ref ReadOnlySpan span, ref int callOutIndex, int originatingLine) { - var indexOfLastComment = Math.Max(span.LastIndexOf('#'), span.LastIndexOf("//")); + var indexOfLastComment = Math.Max(span.LastIndexOf(" # "), span.LastIndexOf(" // ")); var startIndex = span.LastIndexOf('<'); if (startIndex <= 0) return [];