Merge remote-tracking branch 'n-peugnet/display-inline-code'

This commit is contained in:
Tulir Asokan 2022-04-16 19:26:08 +03:00
commit a8660c7137
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,8 @@
(thanks to [@3nprob] in [#328]). (thanks to [@3nprob] in [#328]).
* Added support for shortcodes *without* tab-completion in `/react` * Added support for shortcodes *without* tab-completion in `/react`
(thanks to [@tleb] in [#354]). (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 * Added tab-completion support for `/toggle` options
(thanks to [@n-peugnet] in [#362]). (thanks to [@n-peugnet] in [#362]).
* Added initial support for rendering spoilers in messages. * Added initial support for rendering spoilers in messages.
@ -24,6 +26,7 @@
[@n-peugnet]: https://github.com/n-peugnet [@n-peugnet]: https://github.com/n-peugnet
[#328]: https://github.com/tulir/gomuks/pull/328 [#328]: https://github.com/tulir/gomuks/pull/328
[#354]: https://github.com/tulir/gomuks/pull/354 [#354]: https://github.com/tulir/gomuks/pull/354
[#361]: https://github.com/tulir/gomuks/pull/361
[#362]: https://github.com/tulir/gomuks/pull/362 [#362]: https://github.com/tulir/gomuks/pull/362
# v0.2.4 (2021-09-21) # v0.2.4 (2021-09-21)

View File

@ -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)