Skip to content

Commit

Permalink
Merge remote-tracking branch 'n-peugnet/display-inline-code'
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Apr 16, 2022
2 parents f0d7879 + 0da7d78 commit a8660c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
(thanks to [@3nprob] in [#328]).
* Added support for shortcodes *without* tab-completion in `/react`
(thanks to [@tleb] in [#354]).
* Added background color to differentiate `inline code`
(thanks to [@n-peugnet] in [#361]).
* Added tab-completion support for `/toggle` options
(thanks to [@n-peugnet] in [#362]).
* Added initial support for rendering spoilers in messages.
Expand All @@ -24,6 +26,7 @@
[@n-peugnet]: https://github.com/n-peugnet
[#328]: https://github.com/tulir/gomuks/pull/328
[#354]: https://github.com/tulir/gomuks/pull/354
[#361]: https://github.com/tulir/gomuks/pull/361
[#362]: https://github.com/tulir/gomuks/pull/362

# v0.2.4 (2021-09-21)
Expand Down
7 changes: 6 additions & 1 deletion ui/messages/html/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func (parser *htmlParser) basicFormatToEntity(node *html.Node) Entity {
entity.AdjustStyle(AdjustStyleStrikethrough, AdjustStyleReasonNormal)
case "u", "ins":
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":
fgColor, ok := parser.parseColor(node, "data-mx-color", "color")
if ok {
Expand Down Expand Up @@ -357,7 +362,7 @@ func (parser *htmlParser) tagNodeToEntity(node *html.Node) Entity {
return parser.headerToEntity(node)
case "br":
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)
case "a":
return parser.linkToEntity(node)
Expand Down

0 comments on commit a8660c7

Please sign in to comment.