Skip to content

Commit f67ccd1

Browse files
Merge pull request #4095 from RosarioPulella/fix/sample-app/markdown-renderer
Check style.Ignore if style is not null.
2 parents f62a60b + 33020eb commit f67ccd1

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

Microsoft.Toolkit.Uwp.SampleApp/Controls/SampleAppMarkdownRenderer.cs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -270,44 +270,46 @@ protected override void RenderQuote(QuoteBlock element, IRenderContext context)
270270
else if (firstInline is TextRunInline textRunInline)
271271
{
272272
var key = textRunInline.Text.Split(' ').FirstOrDefault();
273-
if (styles.TryGetValue(key, out var style) && !style.Ignore)
273+
if (styles.TryGetValue(key, out var style))
274274
{
275-
noteType = style;
276-
header = style.IdentifierReplacement;
277-
symbolGlyph = style.Glyph;
275+
if (!style.Ignore)
276+
{
277+
noteType = style;
278+
header = style.IdentifierReplacement;
279+
symbolGlyph = style.Glyph;
278280

279-
// Removes the identifier from the text
280-
textRunInline.Text = textRunInline.Text.Replace(key, string.Empty);
281+
// Removes the identifier from the text
282+
textRunInline.Text = textRunInline.Text.Replace(key, string.Empty);
281283

282-
if (theme == ElementTheme.Light)
283-
{
284-
localForeground = style.LightForeground;
285-
localBackground = style.LightBackground;
286-
}
287-
else
288-
{
289-
localForeground = new SolidColorBrush(Colors.White);
290-
localBackground = style.DarkBackground;
291-
}
284+
if (theme == ElementTheme.Light)
285+
{
286+
localForeground = style.LightForeground;
287+
localBackground = style.LightBackground;
288+
}
289+
else
290+
{
291+
localForeground = new SolidColorBrush(Colors.White);
292+
localBackground = style.DarkBackground;
293+
}
292294

293-
// Apply special formatting context.
294-
if (noteType != null)
295-
{
296-
if (localContext?.Clone() is UIElementCollectionRenderContext newContext)
295+
// Apply special formatting context.
296+
if (noteType != null)
297297
{
298-
localContext = newContext;
298+
if (localContext?.Clone() is UIElementCollectionRenderContext newContext)
299+
{
300+
localContext = newContext;
299301

300-
localContext.TrimLeadingWhitespace = true;
301-
QuoteForeground = Foreground;
302-
LinkForeground = localForeground;
302+
localContext.TrimLeadingWhitespace = true;
303+
QuoteForeground = Foreground;
304+
LinkForeground = localForeground;
305+
}
303306
}
304307
}
305-
}
306-
307-
if (style.Ignore)
308-
{
309-
// Blank entire block
310-
textRunInline.Text = string.Empty;
308+
else
309+
{
310+
// Blank entire block
311+
textRunInline.Text = string.Empty;
312+
}
311313
}
312314
}
313315
}

0 commit comments

Comments
 (0)