mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-07-15 18:21:32 +02:00
Add markdown link support; fold bot instructions into markdown; set TextBlock properties directly
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using DiscordChatExporter.Gui.Utils.Extensions;
|
||||
using DiscordChatExporter.Gui.Views.Controls;
|
||||
using Markdig;
|
||||
using Markdig.Syntax;
|
||||
using Markdig.Syntax.Inlines;
|
||||
@@ -78,6 +82,24 @@ public class MarkdownToInlinesConverter : IValueConverter
|
||||
break;
|
||||
}
|
||||
|
||||
case LinkInline link when link.Url is not null:
|
||||
{
|
||||
var text = string.Concat(
|
||||
link.OfType<LiteralInline>().Select(l => l.Content.ToString())
|
||||
);
|
||||
var url = link.Url;
|
||||
inlines.Add(
|
||||
new InlineUIContainer(
|
||||
new HyperLink
|
||||
{
|
||||
Text = text,
|
||||
Command = new RelayCommand(() => Process.StartShellExecute(url)),
|
||||
}
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case ContainerInline container:
|
||||
{
|
||||
foreach (var child in container)
|
||||
|
||||
Reference in New Issue
Block a user