feat: add ability to disable markdown (#544)

This commit is contained in:
Ted 2025-05-23 23:39:18 +01:00 • committed by GitHub
parent 5efbed2d8c
commit af2b0995ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -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) {

View file

@ -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,