|
11 | 11 | mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
12 | 12 | x:Class="NexusMods.App.UI.Controls.MarkdownRenderer.MarkdownRendererView">
|
13 | 13 |
|
| 14 | + <Design.PreviewWith> |
| 15 | + <local:MarkdownRendererDesignViewModel/> |
| 16 | + </Design.PreviewWith> |
| 17 | + |
14 | 18 | <!--
|
15 | 19 | NOTE(erri120): This control can only be styled directly, not through classes.
|
16 | 20 | https://github.com/whistyun/Markdown.Avalonia/wiki/How-to-customise-style
|
17 | 21 | -->
|
18 | 22 | <md:MarkdownScrollViewer x:Name="MarkdownScrollViewer">
|
19 | 23 | <md:MarkdownScrollViewer.Styles>
|
20 |
| - <Style Selector="ctxt|CTextBlock"> |
21 |
| - <Setter Property="FontFamily" Value="{StaticResource FontBodyRegular}" /> |
22 |
| - <Setter Property="Foreground" Value="{StaticResource NeutralSubduedBrush}" /> |
23 |
| - </Style> |
24 |
| - |
25 |
| - <Style Selector="ctxt|CHyperlink"> |
26 |
| - <Setter Property="FontFamily" Value="{StaticResource FontBodyRegular}" /> |
27 |
| - <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" /> |
28 |
| - </Style> |
| 24 | + <!-- NOTE(erri120): designs from https://www.figma.com/design/NuC2DiIdnAZQQkYUSaK514/%F0%9F%93%B1Markdown-styles?node-id=10%3A12&t=mVpreGuSrLB54ms0-1 --> |
| 25 | + <!-- |
| 26 | + NOTE(erri120): we can't apply our custom TextBlock themes because CTextBlock is a unique control type that has nothing to do with TextBlock... |
| 27 | + As a result of this, I copy-pasted our TextBlock themes, which means they can very easily get out-of-sync with the main themes. |
| 28 | + --> |
29 | 29 |
|
30 | 30 | <Style Selector="ctxt|CTextBlock.Heading1">
|
31 | 31 | <Setter Property="FontFamily" Value="{StaticResource FontHeadlinesSemiBold}" />
|
32 |
| - <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" /> |
| 32 | + <Setter Property="FontWeight" Value="SemiBold" /> |
| 33 | + <Setter Property="FontSize" Value="36" /> |
| 34 | + <Setter Property="LineHeight" Value="43.2" /> |
| 35 | + <Setter Property="Foreground" Value="{StaticResource NeutralStrongBrush}" /> |
33 | 36 | </Style>
|
34 | 37 |
|
35 | 38 | <Style Selector="ctxt|CTextBlock.Heading2">
|
36 | 39 | <Setter Property="FontFamily" Value="{StaticResource FontHeadlinesSemiBold}" />
|
37 |
| - <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" /> |
| 40 | + <Setter Property="FontWeight" Value="SemiBold" /> |
| 41 | + <Setter Property="FontSize" Value="24" /> |
| 42 | + <Setter Property="LineHeight" Value="30" /> |
| 43 | + <Setter Property="Foreground" Value="{StaticResource NeutralStrongBrush}" /> |
38 | 44 | </Style>
|
39 | 45 |
|
40 | 46 | <Style Selector="ctxt|CTextBlock.Heading3">
|
41 | 47 | <Setter Property="FontFamily" Value="{StaticResource FontHeadlinesSemiBold}" />
|
42 |
| - <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" /> |
| 48 | + <Setter Property="FontWeight" Value="SemiBold" /> |
| 49 | + <Setter Property="FontSize" Value="18" /> |
| 50 | + <Setter Property="LineHeight" Value="24.75" /> |
| 51 | + <Setter Property="Foreground" Value="{StaticResource NeutralStrongBrush}" /> |
43 | 52 | </Style>
|
44 | 53 |
|
45 | 54 | <Style Selector="ctxt|CTextBlock.Heading4">
|
46 |
| - <Setter Property="FontFamily" Value="{StaticResource FontHeadlinesSemiBold}" /> |
47 |
| - <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" /> |
| 55 | + <Setter Property="FontFamily" Value="{StaticResource FontBodyBold}" /> |
| 56 | + <Setter Property="FontWeight" Value="Bold" /> |
| 57 | + <Setter Property="FontSize" Value="16" /> |
| 58 | + <Setter Property="LineHeight" Value="24" /> |
| 59 | + <Setter Property="Foreground" Value="{StaticResource NeutralStrongBrush}" /> |
48 | 60 | </Style>
|
49 | 61 |
|
50 | 62 | <Style Selector="ctxt|CTextBlock.Heading5">
|
51 | 63 | <Setter Property="FontFamily" Value="{StaticResource FontHeadlinesSemiBold}" />
|
52 |
| - <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" /> |
| 64 | + <Setter Property="FontWeight" Value="SemiBold" /> |
| 65 | + <Setter Property="FontSize" Value="12" /> |
| 66 | + <Setter Property="LineHeight" Value="16.5" /> |
| 67 | + <Setter Property="Foreground" Value="{StaticResource NeutralStrongBrush}" /> |
53 | 68 | </Style>
|
54 | 69 |
|
55 | 70 | <Style Selector="ctxt|CTextBlock.Heading6">
|
56 | 71 | <Setter Property="FontFamily" Value="{StaticResource FontHeadlinesSemiBold}" />
|
| 72 | + <Setter Property="FontWeight" Value="SemiBold" /> |
| 73 | + <Setter Property="FontSize" Value="10" /> |
| 74 | + <Setter Property="LineHeight" Value="15" /> |
| 75 | + <Setter Property="Foreground" Value="{StaticResource NeutralStrongBrush}" /> |
| 76 | + </Style> |
| 77 | + |
| 78 | + <Style Selector="ctxt|CTextBlock.Paragraph"> |
| 79 | + <Setter Property="FontFamily" Value="{StaticResource FontBodyRegular}" /> |
| 80 | + <Setter Property="FontWeight" Value="Normal" /> |
| 81 | + <Setter Property="FontSize" Value="14" /> |
| 82 | + |
| 83 | + <!-- |
| 84 | + NOTE(erri120): LineHeight can't be used because every image gets put into a paragraph. |
| 85 | + Setting LineHeight would also force the image height to that value. |
| 86 | + The library we're using has many issues like this where the ideal solution would be to |
| 87 | + apply styles to a parent control from the child control or from the parent control by |
| 88 | + somehow checking if it has certain child controls. |
| 89 | + --> |
| 90 | + <!-- <Setter Property="LineHeight" Value="21" /> --> |
| 91 | + <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" /> |
| 92 | + </Style> |
| 93 | + |
| 94 | + |
| 95 | + <!-- TODO: bold --> |
| 96 | + <!-- TODO: italic --> |
| 97 | + <!-- TODO: bold and italic --> |
| 98 | + <!-- TODO: block quote --> |
| 99 | + <!-- TODO: nested block quote --> |
| 100 | + <!-- TODO: numbered list --> |
| 101 | + <!-- TODO: list --> |
| 102 | + |
| 103 | + <Style Selector="ctxt|CCode ctxt|CRun"> |
| 104 | + <!-- TODO: use Roboto Mono --> |
| 105 | + <Setter Property="FontSize" Value="13" /> |
| 106 | + <!-- <Setter Property="LineHeight" Value="19.5" /> --> |
57 | 107 | <Setter Property="Foreground" Value="{StaticResource NeutralModerateBrush}" />
|
| 108 | + <Setter Property="Background" Value="{StaticResource SurfaceTopBrush}" /> |
58 | 109 | </Style>
|
| 110 | + |
| 111 | + <Style Selector="ctxt|CHyperlink"> |
| 112 | + <Setter Property="HoverForeground" Value="{StaticResource BrandLegacyPrimaryStrong}"/> |
| 113 | + |
| 114 | + <Style Selector="^ ctxt|CRun"> |
| 115 | + <Setter Property="Foreground" Value="{StaticResource BrandLegacyPrimaryStrong}" /> |
| 116 | + <Setter Property="IsUnderline" Value="True" /> |
| 117 | + </Style> |
| 118 | + </Style> |
| 119 | + |
| 120 | + <Style Selector="ctxt|CImage"> |
| 121 | + <Setter Property="SaveAspectRatio" Value="True"/> |
| 122 | + </Style> |
| 123 | + |
| 124 | + <!-- TODO: tables --> |
| 125 | + |
59 | 126 | </md:MarkdownScrollViewer.Styles>
|
60 | 127 | </md:MarkdownScrollViewer>
|
61 | 128 |
|
|
0 commit comments