MarkView.Avalonia.SyntaxHighlighting
12.4.1
dotnet add package MarkView.Avalonia.SyntaxHighlighting --version 12.4.1
NuGet\Install-Package MarkView.Avalonia.SyntaxHighlighting -Version 12.4.1
<PackageReference Include="MarkView.Avalonia.SyntaxHighlighting" Version="12.4.1" />
<PackageVersion Include="MarkView.Avalonia.SyntaxHighlighting" Version="12.4.1" />
<PackageReference Include="MarkView.Avalonia.SyntaxHighlighting" />
paket add MarkView.Avalonia.SyntaxHighlighting --version 12.4.1
#r "nuget: MarkView.Avalonia.SyntaxHighlighting, 12.4.1"
#:package MarkView.Avalonia.SyntaxHighlighting@12.4.1
#addin nuget:?package=MarkView.Avalonia.SyntaxHighlighting&version=12.4.1
#tool nuget:?package=MarkView.Avalonia.SyntaxHighlighting&version=12.4.1
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.1)
- TextMateSharp (>= 2.0.4)
- TextMateSharp.Grammars (>= 2.0.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MarkView.Avalonia.SyntaxHighlighting:
| Package | Downloads |
|---|---|
|
Niddy.Avalonia
Niddy: my personal .NET utilities. Avalonia UI helpers: app hosting, dialogs (window and overlay, including color, markdown with Mermaid diagrams and math, table and web), a page system with menus and keyboard shortcuts, toasts with actions and progress, paged and sortable data tables, window and layout memory, a global exception handler, converters, responsive layout, theming and file pickers. |
GitHub repositories
This package is not used by any popular GitHub repositories.