소스 검색

feat(markdown): add support for mention_color

ayn2op 10 달 전
부모
커밋
7baf434235
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      internal/markdown/renderer.go

+ 3 - 2
internal/markdown/renderer.go

@@ -136,7 +136,8 @@ func (r *renderer) renderInline(w io.Writer, n *discordmd.Inline, entering bool)
 
 func (r *renderer) renderMention(w io.Writer, n *discordmd.Mention, entering bool) {
 	if entering {
-		io.WriteString(w, "[::b]")
+		mentionColor := r.config.Options["mentionColor"].(string)
+		_, _ = fmt.Fprintf(w, "[%s::b]", mentionColor)
 
 		switch {
 		case n.Channel != nil:
@@ -151,7 +152,7 @@ func (r *renderer) renderMention(w io.Writer, n *discordmd.Mention, entering boo
 			io.WriteString(w, "@"+n.GuildRole.Name)
 		}
 	} else {
-		io.WriteString(w, "[::B]")
+		io.WriteString(w, "[-::B]")
 	}
 }