From 05709d0f845144397e7689be4fba6a50370282e8 Mon Sep 17 00:00:00 2001 From: Juan Osorio Date: Thu, 14 Nov 2024 14:15:26 -0800 Subject: [PATCH] Temporary fix for Fenced code block rendering --- .../src/TextElements/MyCodeBlock.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/components/MarkdownTextBlock/src/TextElements/MyCodeBlock.cs b/components/MarkdownTextBlock/src/TextElements/MyCodeBlock.cs index 862c7de19..f6efcf0c2 100644 --- a/components/MarkdownTextBlock/src/TextElements/MyCodeBlock.cs +++ b/components/MarkdownTextBlock/src/TextElements/MyCodeBlock.cs @@ -30,6 +30,7 @@ public MyCodeBlock(CodeBlock codeBlock, MarkdownConfig config) border.CornerRadius = _config.Themes.CornerRadius; var richTextBlock = new RichTextBlock(); +#if false if (codeBlock is FencedCodeBlock fencedCodeBlock) { //#if !WINAPPSDK @@ -68,17 +69,19 @@ public MyCodeBlock(CodeBlock codeBlock, MarkdownConfig config) } else { - foreach (var line in codeBlock.Lines.Lines) +#endif + + foreach (var line in codeBlock.Lines.Lines) + { + var paragraph = new Paragraph(); + var lineString = line.ToString(); + if (!String.IsNullOrWhiteSpace(lineString)) { - var paragraph = new Paragraph(); - var lineString = line.ToString(); - if (!String.IsNullOrWhiteSpace(lineString)) - { - paragraph.Inlines.Add(new Run() { Text = lineString }); - } - richTextBlock.Blocks.Add(paragraph); + paragraph.Inlines.Add(new Run() { Text = lineString }); } + richTextBlock.Blocks.Add(paragraph); } + border.Child = richTextBlock; container.Child = border; _paragraph.Inlines.Add(container);