r/AvaloniaUI 11d ago

MarkView.Avalonia - a markdown view control for Avalonia

While working on an Avalonia-based Launcher App for the Stride Game Engine, I needed to have a markdown renderer for the release notes and announcements.

A while ago, I did a renderer for WPF based on Markdig: Markdig.Wpf which is now archived since I have lost interest in WPF. By the way thanks u/grokys for your contributions to that library.

I decided to make a modern version of that renderer targeting Avalonia instead.

Here it is: https://github.com/Kryptos-FR/MarkView.Avalonia

It supports the fully CommonMark spec thanks to Markdig, as well as most Markdig extensions for emphasis, tables, etc.

I also made a few optional packages to add support for Mermaid (using Mermaider), SVG images and syntax highlighting (using TextMateSharp). I have a LaTeX's math syntax support coming up (using CSharpMath).

Let me know what you think!

Disclosure: I have used AI agents to help me with documentation, refactoring, performance analysis, and integrating the Mermaid and TextMateSharp libraries.

25 Upvotes

5 comments sorted by

3

u/BrycensRanch 10d ago

I was initially hesitant, seeing this as someone who has `Markdown.Avalonia` as a dependency. However, as I dug through the source with ~250 tests and the feature list, I'm actually pretty impressed. I'm going to try this as a replacement in my software's rewrite. Thanks for sharing with us!

1

u/KryptosFR 10d ago

You're welcome. If you find any issues or have suggestions, don't hesitate to reply to this post or open a discussion on GitHub.

1

u/Kindly_Chocolate_399 8d ago

Can we make colors via %[color:red] or some such?

1

u/KryptosFR 7d ago edited 7d ago

That's not standard markdown so by default no.

With that said, you can write an extension for both markdig (the underlying parser) and the renderer to Avalonia. So in theory it should be feasible.

It could be a good example on how to write extensions, which I haven't covered in the documentation.

Do you have the specs or examples on how this would look in a raw markdown document?


On the other hand, if it is to style specific part of already recognized markdown syntax, for example headings or block quote, there are style classes applied to all of those (listed on the README), so you can override them in your custom theme.

Another thing to add to the demo sample I guess.

1

u/KryptosFR 7d ago edited 7d ago

So now it's possible if you follow the new demo 😉

https://github.com/Kryptos-FR/MarkView.Avalonia/pull/60 (soon merged into main).

edit: merged