Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarkdownTextBlock: Temporary fix for Fenced code block rendering #595

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions components/MarkdownTextBlock/src/TextElements/MyCodeBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Loading