Add markdown support for channel topics in HTML export (#720)

Co-authored-by: Alexey Golub <1935960+Tyrrrz@users.noreply.github.com>
pull/727/head
Emily 3 years ago committed by GitHub
parent 21d89afa70
commit 46450367e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,6 +14,8 @@
string FormatDate(DateTimeOffset date) => Model.ExportContext.FormatDate(date);
ValueTask<string> ResolveUrlAsync(string url) => Model.ExportContext.ResolveMediaUrlAsync(url, CancellationToken);
string FormatMarkdown(string markdown) => Model.FormatMarkdown(markdown);
}
<!DOCTYPE html>
@ -692,7 +694,7 @@
@if (!string.IsNullOrWhiteSpace(Model.ExportContext.Request.Channel.Topic))
{
<div class="preamble__entry preamble__entry--small">@Model.ExportContext.Request.Channel.Topic</div>
<div class="preamble__entry preamble__entry--small">@Raw(FormatMarkdown(Model.ExportContext.Request.Channel.Topic))</div>
}
@if (Model.ExportContext.Request.After is not null || Model.ExportContext.Request.Before is not null)

@ -1,4 +1,6 @@
namespace DiscordChatExporter.Core.Exporting.Writers.Html
using DiscordChatExporter.Core.Exporting.Writers.MarkdownVisitors;
namespace DiscordChatExporter.Core.Exporting.Writers.Html
{
internal class PreambleTemplateContext
{
@ -11,5 +13,8 @@
ExportContext = exportContext;
ThemeName = themeName;
}
public string FormatMarkdown(string? markdown, bool isJumboAllowed = true) =>
HtmlMarkdownVisitor.Format(ExportContext, markdown ?? "", isJumboAllowed);
}
}
Loading…
Cancel
Save