Skip to content

Commit c55b287

Browse files
committed
Review edit
1 parent 48d7319 commit c55b287

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,9 @@ private static void WriteDiagramBlock(LlmMarkdownRenderer renderer, DiagramBlock
431431
// Render the diagram content with indentation
432432
if (!string.IsNullOrWhiteSpace(diagramBlock.Content))
433433
{
434-
var lines = diagramBlock.Content.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
435-
foreach (var line in lines)
436-
{
437-
renderer.WriteLine(line);
438-
}
434+
var reader = new StringReader(diagramBlock.Content);
435+
while (reader.ReadLine() is { } line)
436+
renderer.WriteLine(string.IsNullOrWhiteSpace(line) ? string.Empty : " " + line);
439437
}
440438

441439
renderer.WriteLine("</diagram>");

tests/authoring/LlmMarkdown/LlmMarkdownOutput.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -510,16 +510,16 @@ y -> z: nice to meet you
510510
let ``renders diagram with type information`` () =
511511
markdown |> convertsToNewLLM """
512512
<diagram type="mermaid">
513-
flowchart LR
514-
A[Start] --> B{Decision}
515-
B -->|Yes| C[Action 1]
516-
B -->|No| D[Action 2]
517-
C --> E[End]
518-
D --> E
513+
flowchart LR
514+
A[Start] --> B{Decision}
515+
B -->|Yes| C[Action 1]
516+
B -->|No| D[Action 2]
517+
C --> E[End]
518+
D --> E
519519
</diagram>
520520

521521
<diagram type="d2">
522-
x -> y: hello world
523-
y -> z: nice to meet you
522+
x -> y: hello world
523+
y -> z: nice to meet you
524524
</diagram>
525525
"""

0 commit comments

Comments
 (0)