mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-31 14:58:22 -04:00
Add markdown support for channel topics in HTML export (#720)
Co-authored-by: Alexey Golub <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
parent
21d89afa70
commit
46450367e3
2 changed files with 9 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue