Skip to content

Commit

Permalink
Merge pull request #4095 from RosarioPulella/fix/sample-app/markdown-…
Browse files Browse the repository at this point in the history
…renderer

Check style.Ignore if style is not null.
  • Loading branch information
michael-hawker committed Jul 20, 2021
2 parents f62a60b + 33020eb commit f67ccd1
Showing 1 changed file with 32 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,44 +270,46 @@ protected override void RenderQuote(QuoteBlock element, IRenderContext context)
else if (firstInline is TextRunInline textRunInline)
{
var key = textRunInline.Text.Split(' ').FirstOrDefault();
if (styles.TryGetValue(key, out var style) && !style.Ignore)
if (styles.TryGetValue(key, out var style))
{
noteType = style;
header = style.IdentifierReplacement;
symbolGlyph = style.Glyph;
if (!style.Ignore)
{
noteType = style;
header = style.IdentifierReplacement;
symbolGlyph = style.Glyph;

// Removes the identifier from the text
textRunInline.Text = textRunInline.Text.Replace(key, string.Empty);
// Removes the identifier from the text
textRunInline.Text = textRunInline.Text.Replace(key, string.Empty);

if (theme == ElementTheme.Light)
{
localForeground = style.LightForeground;
localBackground = style.LightBackground;
}
else
{
localForeground = new SolidColorBrush(Colors.White);
localBackground = style.DarkBackground;
}
if (theme == ElementTheme.Light)
{
localForeground = style.LightForeground;
localBackground = style.LightBackground;
}
else
{
localForeground = new SolidColorBrush(Colors.White);
localBackground = style.DarkBackground;
}

// Apply special formatting context.
if (noteType != null)
{
if (localContext?.Clone() is UIElementCollectionRenderContext newContext)
// Apply special formatting context.
if (noteType != null)
{
localContext = newContext;
if (localContext?.Clone() is UIElementCollectionRenderContext newContext)
{
localContext = newContext;

localContext.TrimLeadingWhitespace = true;
QuoteForeground = Foreground;
LinkForeground = localForeground;
localContext.TrimLeadingWhitespace = true;
QuoteForeground = Foreground;
LinkForeground = localForeground;
}
}
}
}

if (style.Ignore)
{
// Blank entire block
textRunInline.Text = string.Empty;
else
{
// Blank entire block
textRunInline.Text = string.Empty;
}
}
}
}
Expand Down

0 comments on commit f67ccd1

Please sign in to comment.