Skip to content

Commit

Permalink
Add support for syntax highlighted code blocks (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
hloeung authored Nov 12, 2022
1 parent ecdb3bd commit 63d03de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm-go-irckit/userbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (u *User) handleDirectMessageEvent(event *bridge.DirectMessageEvent) {
text = wordwrap.String(text, maxlen)
lines := strings.Split(text, "\n")
for _, text := range lines {
if text == "```" {
if strings.HasPrefix(text, "```") {
codeBlock = !codeBlock
}
// skip empty lines for anything not part of a code block.
Expand Down Expand Up @@ -287,7 +287,7 @@ func (u *User) handleChannelMessageEvent(event *bridge.ChannelMessageEvent) {
text = wordwrap.String(text, maxlen)
lines := strings.Split(text, "\n")
for _, text := range lines {
if text == "```" {
if strings.HasPrefix(text, "```") {
codeBlock = !codeBlock
}
// skip empty lines for anything not part of a code block.
Expand Down

0 comments on commit 63d03de

Please sign in to comment.