Open michael-hawker opened 5 years ago
As mentioned in #2806 to @michael-hawker for the related issue, I can confirm that this too can be fixed (at least as a quick workaround) by replacing this line: https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/a722f171cac7959d8fb39d732c5951018a2e8c07/Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/Render/MarkdownRenderer.Inlines.cs#L581
With this code:
try
{
localContext.InlineCollection.Add(inlineUIContainer);
}
catch (ArgumentException)
{
// Fallback span
Run run = new Run
{
Text = text.Text,
FontFamily = InlineCodeFontFamily ?? FontFamily,
Foreground = InlineCodeForeground ?? Foreground
};
// Additional formatting
if (localContext.WithinItalics) run.FontStyle = FontStyle.Italic;
if (localContext.WithinBold) run.FontWeight = FontWeights.Bold;
// Add the fallback block
localContext.InlineCollection.Add(run);
}
This will still render the code with the usual code font/foreground, and will just lack the additional background color (as it's just a Span
). Still though, the visual difference is negligible, and at least this will work instead of just crashing and halting the whole rendering process.
This issue seems inactive. It will automatically be closed in 14 days if there is no activity.
following valid markdown
Micrsoft does advise against formatting text in a link, though...
I'm submitting a...
Current behavior
Trying to render the following valid markdown doesn't work:
Expected behavior
Windows.UI.Composition
APIsMinimal reproduction of the problem with instructions
1) Open Sample App 2) Open MarkDownTextBlock sample 3) Add the following markdown to the textbox at the top:
Exception thrown in last line of RenderCodeRun trying to add inline to collection -
System.ArgumentException: 'Value does not fall within the expected range.'
Environment