MarkView.Avalonia.SyntaxHighlighting
12.4.0
dotnet add package MarkView.Avalonia.SyntaxHighlighting --version 12.4.0
NuGet\Install-Package MarkView.Avalonia.SyntaxHighlighting -Version 12.4.0
<PackageReference Include="MarkView.Avalonia.SyntaxHighlighting" Version="12.4.0" />
<PackageVersion Include="MarkView.Avalonia.SyntaxHighlighting" Version="12.4.0" />
<PackageReference Include="MarkView.Avalonia.SyntaxHighlighting" />
paket add MarkView.Avalonia.SyntaxHighlighting --version 12.4.0
#r "nuget: MarkView.Avalonia.SyntaxHighlighting, 12.4.0"
#:package MarkView.Avalonia.SyntaxHighlighting@12.4.0
#addin nuget:?package=MarkView.Avalonia.SyntaxHighlighting&version=12.4.0
#tool nuget:?package=MarkView.Avalonia.SyntaxHighlighting&version=12.4.0
MarkView.Avalonia.SyntaxHighlighting
Syntax highlighting of code blocks for MarkView.Avalonia, with the TextMate grammars and themes that VS Code uses. Switching between light and dark only recolours the code: the document is not rebuilt, and the scroll position is kept.
Installation
dotnet add package MarkView.Avalonia.SyntaxHighlighting
Usage
viewer.UseTextMateHighlighting(); // Dark+ and Light+
// other themes, from TextMateSharp.Grammars
viewer.UseTextMateHighlighting(darkTheme: ThemeName.Monokai, lightTheme: ThemeName.QuietLight);
// every viewer of the application, at startup
MarkdownViewerDefaults.Extensions.AddTextMateHighlighting();
Fenced code blocks with a language are coloured; a language without a grammar shows as plain code. Viewers that use the same pair of themes share one highlighter, so the grammars are loaded once however many viewers there are.
Documentation
- Syntax highlighting: themes, lazy colouring and highlighting outside the viewer.
- Writing a custom code highlighter:
ICodeHighlighterand theme-aware highlighters.
The documentation site covers the whole library, and the demo shows every feature in the browser.
License
MIT © Nicolas Musset
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MarkView.Avalonia (>= 12.4.0)
- TextMateSharp (>= 2.0.4)
- TextMateSharp.Grammars (>= 2.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.