Skip to content

Commit 8eb4a66

Browse files
authored
Merge branch 'main' into theletterf-add-kroki-support
2 parents 419d739 + 3ecf00e commit 8eb4a66

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/Elastic.Markdown/Myst/Renderers/LlmMarkdown/LlmBlockRenderers.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,10 @@ protected override void Write(LlmMarkdownRenderer renderer, HeadingBlock obj)
8181
{
8282
renderer.EnsureBlockSpacing();
8383
renderer.WriteLine();
84-
85-
var headingText = ExtractHeadingText(obj);
86-
8784
renderer.Write(new string('#', obj.Level));
8885
renderer.Write(" ");
89-
renderer.WriteLine(headingText);
90-
}
91-
92-
private static string ExtractHeadingText(HeadingBlock heading)
93-
{
94-
if (heading.Inline == null)
95-
return string.Empty;
96-
return heading.Inline.Descendants()
97-
.OfType<LiteralInline>()
98-
.Select(l => l.Content.ToString())
99-
.Aggregate(string.Empty, (current, text) => current + text);
86+
if (obj.Inline is not null)
87+
renderer.WriteChildren(obj.Inline);
10088
}
10189
}
10290

tests/authoring/LlmMarkdown/LlmMarkdownOutput.fs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ type ``codeblock in list`` () =
445445
```
446446
"""
447447

448-
type ``substitions`` () =
448+
type ``substitutions`` () =
449449
static let markdown = Setup.Document """---
450450
sub:
451451
hello-world: "Hello World!"
@@ -462,7 +462,7 @@ Hello, this is a substitution: Hello World!
462462
This is not a substitution: {{not-found}}
463463
"""
464464

465-
type ``substition in codeblock`` () =
465+
type ``substitution in codeblock`` () =
466466
static let markdown = Setup.Document """---
467467
sub:
468468
hello-world: "Hello World!"
@@ -523,3 +523,18 @@ y -> z: nice to meet you
523523
y -> z: nice to meet you
524524
</diagram>
525525
"""
526+
527+
type ``substitution in heading`` () =
528+
static let markdown = Setup.Document """---
529+
sub:
530+
world: "World"
531+
---
532+
533+
## Hello, {{world}}!
534+
"""
535+
536+
[<Fact>]
537+
let ``renders correctly`` () =
538+
markdown |> convertsToNewLLM """
539+
## Hello, World!
540+
"""

0 commit comments

Comments
 (0)