Open JoeTomkinson opened 4 months ago
There's actually a handful of issues upon looking over it a bit closer, so far I've identified the following:
Newlines are not handled so there's no spacing between paragraphs if there's empty lines in the markdown content.
Bullets are not indented and there's no spacing betwen the bullet and the first word of the run.
Code Block doesn't render the language type and colours as the formatting is commented out, relates directly the the initial problem, easy fix though.
Inadvertant spacing - When pasting in code that then gets rendered to a MarkdownTextblock inside of a chat bubble, it adds a lot of whitespace to the bottom of the code block, not sure why yet still looking into that one.
I have some examples of the spacing and whatnot.
I am using MarkdownTextBlock
in a ContentDialog
. The markdown part of this looks like,
var markdownTextBlock = new MarkdownTextBlock()
{
Text = @"DLSS Swapper should find games from your installed game libraries automatically. If your game is not listed there may be a few settings preventing it. Please check:
- Games list filter is not set to ""Hide non-DLSS games""
- Specific game library is enabled in settings
If you have checked these and your game is still not showing up there may be a bug. We would appreciate it if you could report the issue on our GitHub repository so we can make a fix and have your games better detected in the future.",
Background = new SolidColorBrush(Microsoft.UI.Colors.Transparent),
};
In the old v7 version it would generate a window that would look like,
After moving to CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock
, version 0.1.240906-build.1745
it now looks like,
Looking at the examples I could see they were also using a MarkdownConfig
object. After I created an empty one of those and applied to to the Config
property I now get.
As @JoeTomkinson said, newlines and bullet spacing is broken.
Looking at the examples again I can see here is a bunch of
symbols. So adding those in I get this code,
var markdownTextBlock = new MarkdownTextBlock()
{
Text = @"DLSS Swapper should find games from your installed game libraries automatically. If your game is not listed there may be a few settings preventing it. Please check:
- Games list filter is not set to ""Hide non-DLSS games""
- Specific game library is enabled in settings
If you have checked these and your game is still not showing up there may be a bug. We would appreciate it if you could report the issue on our GitHub repository so we can make a fix and have your games better detected in the future.",
Background = new SolidColorBrush(Microsoft.UI.Colors.Transparent),
Config = new MarkdownConfig(),
};
which produces this output,
It's certainly more readable, and for my in app markdown I can modify text or swap to a formatted textblock of some sort. But I also pull in release notes from GitHub which would then need the
treatment throughout it which may then display incorrectly for older versions of the app, and then display incorrectly again when MarkdownTextBlock
is more mature.
Before this goes live it would also be good to get MarkdownConfig
set by default to make the migration process easier.
EDIT: I was curious what changelog looks like,
Old:
New:
Describe the bug
The 'MyCodeBlock' in the pre-release of the MarkDownTextBlock doesnt actually use the lines of text for anything resulting in empty code blocks. I've attached the class snippet below so you can see what I mean.
components/MarkdownTextBlock/src/TextElements/MyCodeBlock.cs
Steps to reproduce
Expected behavior
Can see the lines of code rendered within the code block.
Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
2022
Visual Studio Build Number
No response
Device form factor
Desktop
Additional context
No response
Help us help you
Yes, but only if others can assist.