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 4906ae0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mm-go-irckit/userbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,21 +1188,24 @@ 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`),
}

Check failure on line 1200 in mm-go-irckit/userbridge.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
var boldRegExp2 = []*regexp.Regexp{

Check failure on line 1201 in mm-go-irckit/userbridge.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var `boldRegExp2` is unused (unused)
regexp.MustCompile(`(?:\*\*)+?(.+?)(?:\*\*)+?`),
}

// 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 4906ae0

Please sign in to comment.