From c7edbc3947380898c995bbd73ef4f26b8cfbcde3 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Tue, 30 Jun 2026 17:27:55 -0400 Subject: [PATCH] fix(markdown): apply combined inline styles --- internal/markdown/renderer.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/internal/markdown/renderer.go b/internal/markdown/renderer.go index bb5fd34..1513961 100644 --- a/internal/markdown/renderer.go +++ b/internal/markdown/renderer.go @@ -264,22 +264,24 @@ func mentionText(node *discordmd.Mention) string { } func applyInlineAttr(style tcell.Style, attr discordmd.Attribute, inLink bool) tcell.Style { - switch attr { - case discordmd.AttrBold: - return style.Bold(true) - case discordmd.AttrItalics: - return style.Italic(true) - case discordmd.AttrUnderline: - return style.Underline(true) - case discordmd.AttrStrikethrough: - return style.StrikeThrough(true) - case discordmd.AttrMonospace: + if attr&discordmd.AttrBold != 0 { + style = style.Bold(true) + } + if attr&discordmd.AttrItalics != 0 { + style = style.Italic(true) + } + if attr&discordmd.AttrUnderline != 0 { + style = style.Underline(true) + } + if attr&discordmd.AttrStrikethrough != 0 { + style = style.StrikeThrough(true) + } + if attr&discordmd.AttrMonospace != 0 { // Avoid reverse-video inside links. Link labels like `hash` should still // look like links, not highlighted blocks. - if inLink { - return style + if !inLink { + style = style.Reverse(true) } - return style.Reverse(true) } return style }