How to customise style Code - whistyun/Markdown.Avalonia GitHub Wiki
In Markdown.Avalonia, CCode is used for inline code.
For now code block is displaied by TextBlock.CodeBlock.

Markdown.Avalonia uses AvaloniaEdit when the language to be used for syntax highlighting is defined.
AvaloniaEdit.TextEditor is used insted of TextBlock.CodeBlock.

If you don't want the AvaloniaEdit.TextEditor dependency, use Markdown.Avalonia.Tight package.
<!--
xmlns:avedit="https://github.com/avaloniaui/avaloniaedit"
xmlns:ctxt="clr-namespace:ColorTextBlock.Avalonia;assembly=ColorTextBlock.Avalonia"
-->
<Style Selector="ctxt|CCode">
<Style.Setters>
<Setter Property="BorderBrush" Value="Green"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="MonospaceFontFamily" Value="Meiryo" />
<Setter Property="Foreground" Value="DarkGreen" />
<Setter Property="Background" Value="LightGreen" />
</Style.Setters>
</Style>
<Style Selector="Border.CodeBlock">
<Style.Setters>
<Setter Property="BorderBrush" Value="Blue"/>
<Setter Property="BorderThickness" Value="0,5,0,5"/>
<Setter Property="Margin" Value="5,0,5,0"/>
<Setter Property="Background" Value="LightBlue"/>
</Style.Setters>
</Style>
<Style Selector="TextBlock.CodeBlock">
<Style.Setters>
<Setter Property="Foreground" Value="DarkBlue"/>
<Setter Property="FontFamily" Value="Meiryo"/>
</Style.Setters>
</Style>
<Style Selector="avedit|TextEditor">
<Setter Property="Background" Value="Pink" />
</Style>inline code: `this is inline.`
```
#include <stdio.h>
int main()
{
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
```
---
```c
#include <stdio.h>
int main()
{
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
```
- Foreground
- Background
- FontFamily
- FontWeight
- FontSize
- FontStyle
- BorderThickness
- BorderBrushProperty
- CornerRadiusProperty
- BoxShadowProperty
- PaddingProperty
- MarginProperty
-
IsUnderline
If true is set, draw line under the text.
-
IsStrikethrough
If true is set, draw strikethrough in the text.
-
MonospaceFontFamily
In CCode, this is treat as FontFamily.