-
Notifications
You must be signed in to change notification settings - Fork 37
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
What is the proper way to gain control over Markdown font size, codeblock style, etc? #14
Comments
MarkdownScrollViewer has MarkdownStyle property. It can change style for each control in Markdown. Styles are identified by the type of control and the value of the tag and applied to each control. <mdxam:MarkdownScrollViewer xml:space="preserve">
# Heading 1
## Heading 2
content
<mdxam:MarkdownScrollViewer.MarkdownStyle>
<Style TargetType="FlowDocument">
<Style.Resources>
<Style TargetType="Paragraph">
<Style.Triggers>
<Trigger Property="Tag" Value="Heading1">
<Setter Property="FontSize" Value="42" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontWeight" Value="Light" />
</Trigger>
<Trigger Property="Tag" Value="Heading2">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="Blue" />
<Setter Property="FontWeight" Value="Light" />
</Trigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
</mdxam:MarkdownScrollViewer.MarkdownStyle>
</mdxam:MarkdownScrollViewer> If you want to make from the existing style, see Markdown.Style.xaml. |
I forgot Style.Based On property. <mdxam:MarkdownScrollViewer.MarkdownStyle>
<Style
TargetType="FlowDocument"
BasedOn="{x:Static mdxam:MarkdownStyle.Standard}">
<Style.Resources>
<Style TargetType="Paragraph">
<Setter Property="Margin" Value="4, 2, 0, 6"/>
<Style.Triggers>
<Trigger Property="Tag" Value="Heading1">
<Setter Property="FontSize" Value="42" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontWeight" Value="Light" />
<Setter Property="Margin" Value="0"/>
</Trigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
</mdxam:MarkdownScrollViewer.MarkdownStyle> |
Within this snippet of markdown for example,
Programmatically adding markdown, e.g
Results in inconsistent Markdown. Here's a few things I noticed in my usage:
MarkdownScrollViewer
's Foreground, thus remain black.MarkdownScrollViewer
's Font properties, most notably, font size.MarkdownScrollViewer
's properties, and remain independent.This could be a result of my (probably) improper usage. How should we go about controlling styling of the Markdown in further depth?
The text was updated successfully, but these errors were encountered: