From af2b0995ba6f6f2df8937cf6a6d5bee3adbc0d0c Mon Sep 17 00:00:00 2001 From: Ted Date: Fri, 23 May 2025 23:39:18 +0100 Subject: [PATCH] feat: add ability to disable markdown (#544) --- cmd/messages_text.go | 6 +++++- internal/config/config.go | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/messages_text.go b/cmd/messages_text.go index 8dff8bd..ab07b4b 100644 --- a/cmd/messages_text.go +++ b/cmd/messages_text.go @@ -162,7 +162,11 @@ func (mt *MessagesText) drawAuthor(msg discord.Message) { func (mt *MessagesText) drawContent(msg discord.Message) { c := []byte(tview.Escape(msg.Content)) ast := discordmd.ParseWithMessage(c, *discordState.Cabinet, &msg, false) - markdown.DefaultRenderer.Render(mt, c, ast) + if app.cfg.MarkdownEnabled { + markdown.DefaultRenderer.Render(mt, c, ast) + } else { + mt.Write(c) // write the content as is + } } func (mt *MessagesText) drawSnapshotContent(msg discord.MessageSnapshotMessage) { diff --git a/internal/config/config.go b/internal/config/config.go index d7c7115..b6e91b3 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -45,6 +45,8 @@ type ( ShowAttachmentLinks bool `toml:"show_attachment_links"` MessagesLimit uint8 `toml:"messages_limit"` + MarkdownEnabled bool `toml:"markdown_enabled"` + Timestamps Timestamps `toml:"timestamps"` Identify Identify `toml:"identify"` Notifications Notifications `toml:"notifications"` @@ -63,6 +65,8 @@ func defaultConfig() *Config { ShowAttachmentLinks: true, MessagesLimit: 50, + MarkdownEnabled: true, + Timestamps: Timestamps{ Enabled: true, Format: time.Kitchen,