Display inline code in messages
The Textcolor is also set to make sure it is readable with black on white themes
This commit is contained in:
parent
e08f23ba65
commit
0da7d78138
@ -139,6 +139,11 @@ func (parser *htmlParser) basicFormatToEntity(node *html.Node) Entity {
|
|||||||
entity.AdjustStyle(AdjustStyleStrikethrough, AdjustStyleReasonNormal)
|
entity.AdjustStyle(AdjustStyleStrikethrough, AdjustStyleReasonNormal)
|
||||||
case "u", "ins":
|
case "u", "ins":
|
||||||
entity.AdjustStyle(AdjustStyleUnderline, AdjustStyleReasonNormal)
|
entity.AdjustStyle(AdjustStyleUnderline, AdjustStyleReasonNormal)
|
||||||
|
case "code":
|
||||||
|
bgColor := tcell.ColorDarkSlateGray
|
||||||
|
fgColor := tcell.ColorWhite
|
||||||
|
entity.AdjustStyle(AdjustStyleBackgroundColor(bgColor), AdjustStyleReasonNormal)
|
||||||
|
entity.AdjustStyle(AdjustStyleTextColor(fgColor), AdjustStyleReasonNormal)
|
||||||
case "font", "span":
|
case "font", "span":
|
||||||
fgColor, ok := parser.parseColor(node, "data-mx-color", "color")
|
fgColor, ok := parser.parseColor(node, "data-mx-color", "color")
|
||||||
if ok {
|
if ok {
|
||||||
@ -357,7 +362,7 @@ func (parser *htmlParser) tagNodeToEntity(node *html.Node) Entity {
|
|||||||
return parser.headerToEntity(node)
|
return parser.headerToEntity(node)
|
||||||
case "br":
|
case "br":
|
||||||
return NewBreakEntity()
|
return NewBreakEntity()
|
||||||
case "b", "strong", "i", "em", "s", "strike", "del", "u", "ins", "font", "span":
|
case "b", "strong", "i", "em", "s", "strike", "del", "u", "ins", "font", "span", "code":
|
||||||
return parser.basicFormatToEntity(node)
|
return parser.basicFormatToEntity(node)
|
||||||
case "a":
|
case "a":
|
||||||
return parser.linkToEntity(node)
|
return parser.linkToEntity(node)
|
||||||
|
Loading…
Reference in New Issue
Block a user