Skip to content

Commit

Permalink
(chocolateyGH-685) Update Markdig.Wpf and Markdown styles
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Mar 2, 2021
1 parent f092d58 commit 317bf65
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@
<Reference Include="MahApps.Metro.IconPacks.Octicons, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0c0d510f9915137a, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.IconPacks.Octicons.4.8.0\lib\net45\MahApps.Metro.IconPacks.Octicons.dll</HintPath>
</Reference>
<Reference Include="Markdig.Signed, Version=0.18.0.0, Culture=neutral, PublicKeyToken=870da25a133885f8, processorArchitecture=MSIL">
<HintPath>..\packages\Markdig.Signed.0.18.0\lib\net40\Markdig.Signed.dll</HintPath>
<Reference Include="Markdig.Signed, Version=0.23.0.0, Culture=neutral, PublicKeyToken=870da25a133885f8, processorArchitecture=MSIL">
<HintPath>..\packages\Markdig.Signed.0.23.0\lib\net452\Markdig.Signed.dll</HintPath>
</Reference>
<Reference Include="Markdig.Wpf, Version=0.3.1.0, Culture=neutral, PublicKeyToken=7b8a8f2a8a0119a0, processorArchitecture=MSIL">
<HintPath>..\packages\Markdig.Wpf.Signed.0.3.1\lib\net452\Markdig.Wpf.dll</HintPath>
<Reference Include="Markdig.Wpf, Version=0.5.0.1, Culture=neutral, PublicKeyToken=7b8a8f2a8a0119a0, processorArchitecture=MSIL">
<HintPath>..\packages\Markdig.Wpf.Signed.0.5.0.1\lib\net452\Markdig.Wpf.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Threading, Version=15.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.VisualStudio.Threading.15.4.4\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>
Expand Down
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>
19 changes: 0 additions & 19 deletions Source/ChocolateyGui.Common.Windows/Resources/Controls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -429,25 +429,6 @@
<Setter Property="FontSize" Value="22" />
</Style>

<Style x:Key="SectionHeaderStyle" BasedOn="{StaticResource MahApps.Styles.MetroHeader}" TargetType="{x:Type controls:MetroHeader}">
<Setter Property="controls:HeaderedControlHelper.HeaderFontSize" Value="28" />
<Setter Property="FontSize" Value="14" />
<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>

<Style x:Key="DescriptionTextStyle" TargetType="{x:Type Run}">
<Setter Property="Foreground" Value="{DynamicResource BodyColorBrush}" />
<Setter Property="FontSize" Value="16" />
Expand Down
6 changes: 3 additions & 3 deletions Source/ChocolateyGui.Common.Windows/Views/PackageView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@

<ScrollViewer Margin="25 5 0 0" Background="{DynamicResource MahApps.Brushes.Control.Background}">
<StackPanel Margin="5 0 5 5">
<mah:MetroHeader Style="{StaticResource SectionHeaderStyle}"
<mah:MetroHeader Style="{StaticResource MarkdownHeading1Style}"
Header="{x:Static properties:Resources.PackageView_Description}">
<i:Interaction.Behaviors>
<utilities:BubbleScrollEventBehavior />
Expand All @@ -245,14 +245,14 @@
Markdown="{Binding Description}" />
</mah:MetroHeader>

<mah:MetroHeader Style="{StaticResource SectionHeaderStyle}"
<mah:MetroHeader Style="{StaticResource MarkdownHeading1Style}"
Header="{x:Static properties:Resources.PackageView_Dependencies}"
Visibility="{Binding Dependencies, Converter={StaticResource NullToVisibility}}">
<TextBlock Text="{Binding Dependencies, Converter={StaticResource PackageDependenciesToString}}"
AutomationProperties.Name="Package Dependencies" />
</mah:MetroHeader>

<mah:MetroHeader Style="{StaticResource SectionHeaderStyle}"
<mah:MetroHeader Style="{StaticResource MarkdownHeading1Style}"
Header="{x:Static properties:Resources.PackageView_ReleaseNotes}"
Visibility="{Binding ReleaseNotes, Converter={StaticResource NullToVisibility}}">
<i:Interaction.Behaviors>
Expand Down
Loading

0 comments on commit 317bf65

Please sign in to comment.