-
Notifications
You must be signed in to change notification settings - Fork 26
Setup AvaloniaEdit for syntax hightlighting
whistyun edited this page Apr 8, 2023
·
4 revisions
Markdown.Avalonia
and Markdown.Avalonia.SyntaxHigh
use AvaloniaEdit for syntax highlighting.
Markdown.Avalonia
adds AvaloniaEdit
styles if an application doesn't have AvaloniaEdit
styles.
AvaloniaEdit
only provides the style for Avalonia.Themes.Simple
for Avalonia.Themes.Fluent
in preview6.
If your application doesn't use either, Markdown.Avalonia
will not be able to add the style.
This means that the code with syntax highlighting will not be displayed.
-
If
App.xaml
allows addSimpleTheme
orFluentTheme
, please add it.App.xaml
<Application xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Markdown.AvaloniaFluentAvaloniaDemo" xmlns:sty="using:FluentAvalonia.Styling" x:Class="Markdown.AvaloniaFluentAvaloniaDemo.App"> <Application.Styles> <SimpleTheme /> <sty:FluentAvaloniaTheme /> <StyleInclude Source="/Assets/AppendingStyles.axaml"/> </Application.Styles> </Application>
-
[experimental: I don't check if this use is legal] add style to
MarkdownScrollViewer.Styles
AnyView.xaml
<!-- xmlns:md="clr-namespace:Markdown.Avalonia;assembly=Markdown.Avalonia" --> <md:MarkdownScrollViewer> <md:MarkdownScrollViewer.Styles> <SimpleTheme /> <StyleInclude Source="avares://AvaloniaEdit/Themes/Simple/AvaloniaEdit.xaml"/> </md:MarkdownScrollViewer.Styles> </md:MarkdownScrollViewer>