Added ability to render slackdown bold.
This commit is contained in:
@@ -416,6 +416,8 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
|
||||
|
||||
allowableTags := []string{
|
||||
"p",
|
||||
"i",
|
||||
"b",
|
||||
"em",
|
||||
"strong",
|
||||
"br",
|
||||
@@ -440,6 +442,17 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
|
||||
return ""
|
||||
},
|
||||
})
|
||||
// Custom override for slackdown
|
||||
html2md.AddRule("b", &html2md.Rule{
|
||||
Patterns: []string{"b", "strong"},
|
||||
Replacement: func(innerHTML string, attrs []string) string {
|
||||
if len(attrs) > 1 {
|
||||
// trailing whitespace due to Mandarin issues
|
||||
return html2md.WrapInlineTag(attrs[1], "*", "* ")
|
||||
}
|
||||
return ""
|
||||
},
|
||||
})
|
||||
// Custom override of default code rule:
|
||||
// This converts multiline code tags to codeblocks
|
||||
html2md.AddRule("code", &html2md.Rule{
|
||||
|
||||
Reference in New Issue
Block a user