forked from chocolatey/ChocolateyGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chocolateyGH-685) Update Markdig.Wpf and Markdown styles
- Loading branch information
Showing
10 changed files
with
210 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
266 changes: 183 additions & 83 deletions
266
Source/ChocolateyGui.Common.Windows/Resources/ControlStyles/Markdown.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,191 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" | ||
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"> | ||
|
||
<Style TargetType="{x:Type markdig:MarkdownViewer}" BasedOn="{StaticResource {x:Type markdig:MarkdownViewer}}"> | ||
<Style.Resources> | ||
<Style TargetType="{x:Type FlowDocument}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.DocumentStyleKey}}" | ||
x:Key="{x:Static markdig:Styles.DocumentStyleKey}"> | ||
<Setter Property="FontFamily" Value="Segoe UI" /> | ||
<Setter Property="FontSize" Value="14" /> | ||
<Setter Property="PagePadding" Value="4" /> | ||
<Setter Property="Foreground" Value="{DynamicResource BodyColorBrush}" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading1StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading1StyleKey}}"> | ||
<Setter Property="FontSize" Value="36.4" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
<Setter Property="Margin" Value="0 16 0 16" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading2StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading2StyleKey}}"> | ||
<Setter Property="FontSize" Value="28" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
<Setter Property="Margin" Value="0 16 0 2" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading3StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading3StyleKey}}"> | ||
<Setter Property="FontSize" Value="22.4" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
<Setter Property="Margin" Value="0 16 0 0" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading4StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading4StyleKey}}"> | ||
<Setter Property="FontSize" Value="19.5" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
<Setter Property="Margin" Value="0 16 0 16" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading5StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading5StyleKey}}"> | ||
<Setter Property="FontSize" Value="15.4" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
<Setter Property="Margin" Value="0 16 0 16" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.CodeBlockStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.CodeBlockStyleKey}}"> | ||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray9}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Run}" | ||
x:Key="{x:Static markdig:Styles.CodeStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.CodeStyleKey}}"> | ||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray9}" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type List}"> | ||
<Setter Property="Margin" Value="0 14 0 14" /> | ||
<Setter Property="Padding" Value="40 0 0 0" /> | ||
</Style> | ||
|
||
<Style TargetType="{x:Type Hyperlink}" | ||
x:Key="{x:Static markdig:Styles.HyperlinkStyleKey}" | ||
BasedOn="{StaticResource MahApps.Styles.Hyperlink}"> | ||
<!-- Document styles --> | ||
<Style TargetType="{x:Type FlowDocument}" | ||
x:Key="{x:Static markdig:Styles.DocumentStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.DocumentStyleKey}}"> | ||
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Control}" /> | ||
<Setter Property="FontSize" Value="{DynamicResource MahApps.Font.Size.Default}" /> | ||
<Setter Property="PagePadding" Value="4" /> | ||
<Setter Property="Foreground" Value="{DynamicResource BodyColorBrush}" /> | ||
</Style> | ||
<Style TargetType="{x:Type List}"> | ||
<Setter Property="Margin" Value="0 14" /> | ||
<Setter Property="Padding" Value="40 0 0 0" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.ParagraphStyleKey}"> | ||
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Control}" /> | ||
<Setter Property="FontSize" Value="{DynamicResource MahApps.Font.Size.Default}" /> | ||
<Setter Property="Foreground" Value="{DynamicResource BodyColorBrush}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.CodeBlockStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.CodeBlockStyleKey}}"> | ||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray9}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Run}" | ||
x:Key="{x:Static markdig:Styles.CodeStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.CodeStyleKey}}"> | ||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray9}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading1StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading1StyleKey}}"> | ||
<Setter Property="FontSize" Value="36.4" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="Margin" Value="0 16" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading2StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading2StyleKey}}"> | ||
<Setter Property="FontSize" Value="28" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="Margin" Value="0 16 0 2" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading3StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading3StyleKey}}"> | ||
<Setter Property="FontSize" Value="22.4" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="Margin" Value="0 16" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading4StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading4StyleKey}}"> | ||
<Setter Property="FontSize" Value="19.5" /> | ||
<Setter Property="Margin" Value="0 16" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading5StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading5StyleKey}}"> | ||
<Setter Property="FontSize" Value="15.4" /> | ||
<Setter Property="Margin" Value="0 16" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Paragraph}" | ||
x:Key="{x:Static markdig:Styles.Heading6StyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.Heading6StyleKey}}"> | ||
<Setter Property="FontSize" Value="12" /> | ||
<Setter Property="Margin" Value="0 16" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Hyperlink}" | ||
x:Key="{x:Static markdig:Styles.HyperlinkStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.HyperlinkStyleKey}}"> | ||
<Setter Property="Foreground" Value="#5c9fd8" /> | ||
<Setter Property="TextDecorations" Value="{x:Null}" /> | ||
<Style.Triggers> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter Property="TextDecorations" Value="Underline" /> | ||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Highlight}" /> | ||
</Trigger> | ||
<Trigger Property="IsEnabled" Value="False"> | ||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | ||
</Trigger> | ||
<Trigger Property="IsEnabled" Value="True"> | ||
<Setter Property="Cursor" Value="Hand" /> | ||
<!-- <Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Accent}" /> --> | ||
<Setter Property="Foreground" Value="#5c9fd8" /> | ||
<Setter Property="TextDecorations" Value="{x:Null}" /> | ||
<Style.Triggers> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter Property="TextDecorations" Value="Underline" /> | ||
</Trigger> | ||
</Style.Triggers> | ||
</Style> | ||
</Style.Resources> | ||
<Setter Property="ForceCursor" Value="True" /> | ||
</Trigger> | ||
</Style.Triggers> | ||
</Style> | ||
<Style TargetType="{x:Type Image}" | ||
x:Key="{x:Static markdig:Styles.ImageStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.ImageStyleKey}}"> | ||
<!-- no changes --> | ||
</Style> | ||
<Style TargetType="{x:Type Section}" | ||
x:Key="{x:Static markdig:Styles.QuoteBlockStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.QuoteBlockStyleKey}}"> | ||
<Setter Property="BorderBrush" Value="LightGray" /> | ||
<Setter Property="BorderThickness" Value="4,0,0,0" /> | ||
<Setter Property="Foreground" Value="Gray" /> | ||
<Setter Property="Padding" Value="16,0,0,0" /> | ||
</Style> | ||
<Style TargetType="{x:Type Table}" | ||
x:Key="{x:Static markdig:Styles.TableStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.TableStyleKey}}"> | ||
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Gray8}" /> | ||
<Setter Property="BorderThickness" Value="0,0,1,1" /> | ||
<Setter Property="CellSpacing" Value="0" /> | ||
</Style> | ||
<Style TargetType="{x:Type TableCell}" | ||
x:Key="{x:Static markdig:Styles.TableCellStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.TableCellStyleKey}}"> | ||
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Gray8}" /> | ||
<Setter Property="BorderThickness" Value="1,1,0,0" /> | ||
</Style> | ||
<Style TargetType="{x:Type TableRow}" | ||
x:Key="{x:Static markdig:Styles.TableHeaderStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.TableHeaderStyleKey}}"> | ||
<Setter Property="FontWeight" Value="Bold" /> | ||
</Style> | ||
<Style TargetType="{x:Type CheckBox}" | ||
x:Key="{x:Static markdig:Styles.TaskListStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.TaskListStyleKey}}"> | ||
<Setter Property="Margin" Value="0,0,0,-2" /> | ||
</Style> | ||
<Style TargetType="{x:Type Line}" | ||
x:Key="{x:Static markdig:Styles.ThematicBreakStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.ThematicBreakStyleKey}}"> | ||
<Setter Property="Stroke" Value="{DynamicResource MahApps.Brushes.Gray8}" /> | ||
</Style> | ||
<Style TargetType="{x:Type Span}" | ||
x:Key="{x:Static markdig:Styles.SubscriptStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.SubscriptStyleKey}}"> | ||
<Setter Property="Typography.Variants" Value="Subscript" /> | ||
</Style> | ||
<Style TargetType="{x:Type Span}" | ||
x:Key="{x:Static markdig:Styles.SuperscriptStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.SuperscriptStyleKey}}"> | ||
<Setter Property="Typography.Variants" Value="Superscript" /> | ||
</Style> | ||
<Style TargetType="{x:Type Span}" | ||
x:Key="{x:Static markdig:Styles.StrikeThroughStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.StrikeThroughStyleKey}}"> | ||
<Setter Property="TextBlock.TextDecorations" Value="Strikethrough" /> | ||
</Style> | ||
<Style TargetType="{x:Type Span}" | ||
x:Key="{x:Static markdig:Styles.InsertedStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.InsertedStyleKey}}"> | ||
<Setter Property="TextBlock.TextDecorations" Value="Underline" /> | ||
</Style> | ||
<Style TargetType="{x:Type Span}" | ||
x:Key="{x:Static markdig:Styles.MarkedStyleKey}" | ||
BasedOn="{StaticResource {x:Static markdig:Styles.MarkedStyleKey}}"> | ||
<Setter Property="Background" Value="Yellow" /> | ||
</Style> | ||
|
||
<Style x:Key="MarkdownHeading1Style" | ||
BasedOn="{StaticResource MahApps.Styles.MetroHeader}" | ||
TargetType="{x:Type mah:MetroHeader}"> | ||
<Setter Property="mah:HeaderedControlHelper.HeaderFontSize" Value="36.4" /> | ||
<Setter Property="mah:HeaderedControlHelper.HeaderFontWeight" Value="Normal" /> | ||
<Setter Property="mah:HeaderedControlHelper.HeaderForeground" Value="{DynamicResource MahApps.Brushes.Gray1}" /> | ||
<!-- <Setter Property="Margin" Value="0 16" /> --> | ||
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Control}" /> | ||
<Setter Property="FontSize" Value="{DynamicResource MahApps.Font.Size.Default}" /> | ||
<Setter Property="Foreground" Value="{DynamicResource BodyColorBrush}" /> | ||
<Setter Property="FontWeight" Value="Normal" /> | ||
<Setter Property="Padding" Value="2 4" /> | ||
<Setter Property="Margin" Value="0 0 0 8" /> | ||
<Setter Property="HeaderTemplate"> | ||
<Setter.Value> | ||
<DataTemplate> | ||
<StackPanel Orientation="Vertical" UseLayoutRounding="True"> | ||
<TextBlock Margin="0 0 0 4" Text="{Binding}" /> | ||
<Separator Margin="0 0 4 0" /> | ||
</StackPanel> | ||
</DataTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.