Refactor tag rendering to avoid recreating goldmark instance for each message

This commit is contained in:
Tulir Asokan
2023-01-30 00:42:20 +02:00
parent 694733a4e9
commit e7615ef4be
3 changed files with 45 additions and 32 deletions

View File

@@ -96,9 +96,11 @@ func (r *discordEveryoneHTMLRenderer) renderDiscordEveryone(w util.BufWriter, so
return
}
type DiscordEveryone struct{}
type discordEveryone struct{}
func (e *DiscordEveryone) Extend(m goldmark.Markdown) {
var ExtDiscordEveryone = &discordEveryone{}
func (e *discordEveryone) Extend(m goldmark.Markdown) {
m.Parser().AddOptions(parser.WithInlineParsers(
util.Prioritized(defaultDiscordEveryoneParser, 600),
))