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{
|
allowableTags := []string{
|
||||||
"p",
|
"p",
|
||||||
|
"i",
|
||||||
|
"b",
|
||||||
"em",
|
"em",
|
||||||
"strong",
|
"strong",
|
||||||
"br",
|
"br",
|
||||||
@@ -440,6 +442,17 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
|
|||||||
return ""
|
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:
|
// Custom override of default code rule:
|
||||||
// This converts multiline code tags to codeblocks
|
// This converts multiline code tags to codeblocks
|
||||||
html2md.AddRule("code", &html2md.Rule{
|
html2md.AddRule("code", &html2md.Rule{
|
||||||
|
|||||||
Reference in New Issue
Block a user