Skip to content

Commit

Permalink
Fixed to use best practices for middle of word emphasis
Browse files Browse the repository at this point in the history
  • Loading branch information
hloeung committed Sep 18, 2023
1 parent 16cc1ce commit 98a3ead
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mm-go-irckit/userbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,21 +1188,21 @@ func (u *User) formatCodeBlockText(text string, prefix string, codeBlockBackTick
// Bold & Italic - https://www.markdownguide.org/basic-syntax#bold-and-italic
var boldItalicRegExp = []*regexp.Regexp{
regexp.MustCompile(`(?:\*\*\*)+?(.+?)(?:\*\*\*)+?`),
regexp.MustCompile(`(?:\_\_\_)+?(.+?)(?:\_\_\_)+?`),
regexp.MustCompile(`(?:\_\_\*)+?(.+?)(?:\*\_\_)+?`),
regexp.MustCompile(`(?:\*\*\_)+?(.+?)(?:\_\*\*)+?`),
regexp.MustCompile(`\b(?:\_\_\_)+?(.+?)(?:\_\_\_)+?\b`),
regexp.MustCompile(`\b(?:\_\_\*)+?(.+?)(?:\*\_\_)+?\b`),
regexp.MustCompile(`\b(?:\*\*\_)+?(.+?)(?:\_\*\*)+?\b`),
}

// Bold - https://www.markdownguide.org/basic-syntax#bold
var boldRegExp = []*regexp.Regexp{
regexp.MustCompile(`(?:\*\*)+?(.+?)(?:\*\*)+?`),
regexp.MustCompile(`(?:\_\_)+?(.+?)(?:\_\_)+?`),
regexp.MustCompile(`\b(?:\_\_)+?(.+?)(?:\_\_)+?\b`),
}

// Italic - https://www.markdownguide.org/basic-syntax#italic
var italicRegExp = []*regexp.Regexp{
regexp.MustCompile(`(?:\*)+?(.+?)(?:\*)+?`),
regexp.MustCompile(`(?:\_)+?(.+?)(?:\_)+?`),
regexp.MustCompile(`(?:\*)+?([^\*]+?)(?:\*)+?`),
regexp.MustCompile(`\b(?:\_)+?([^_]+?)(?:\_)+?\b`),
}

func markdown2irc(msg string) string {
Expand Down

0 comments on commit 98a3ead

Please sign in to comment.