diff --git a/config/keys.go b/config/keys.go
index 860e6d2..4095b72 100644
--- a/config/keys.go
+++ b/config/keys.go
@@ -32,10 +32,6 @@ func ColorKey(c *Config, pre, key, end string) string {
return text
}
-func ColorMark(color tcell.Color) string {
- return fmt.Sprintf("[#%06x]", color.Hex())
-}
-
func TextFlags(s string) string {
return fmt.Sprintf("[::%s]", s)
}
@@ -44,3 +40,7 @@ func SublteText(c *Config, text string) string {
subtle := ColorMark(c.Style.Subtle)
return fmt.Sprintf("%s%s", subtle, text)
}
+
+func ColorMark(color tcell.Color) string {
+ return fmt.Sprintf("[#%06x]", color.Hex())
+}
diff --git a/ui/item_status.go b/ui/item_status.go
index b66e224..26f4730 100644
--- a/ui/item_status.go
+++ b/ui/item_status.go
@@ -104,8 +104,7 @@ func drawStatus(tv *TutView, item api.Item, status *mastodon.Status, main *tview
status = status.Reblog
}
- strippedContent, _ = util.CleanHTML(status.Content)
- strippedContent = tview.Escape(strippedContent)
+ strippedContent, _ = util.CleanHTMLStyled(status.Content)
width := 0
if main != nil {
@@ -162,8 +161,7 @@ func drawStatus(tv *TutView, item api.Item, status *mastodon.Status, main *tview
}
if status.Sensitive {
- strippedSpoiler, _ = util.CleanHTML(status.SpoilerText)
- strippedSpoiler = tview.Escape(strippedSpoiler)
+ strippedSpoiler, _ = util.CleanHTMLStyled(status.SpoilerText)
}
toot.CWText = strippedSpoiler
diff --git a/util/util.go b/util/util.go
index 0c09d5e..738a313 100644
--- a/util/util.go
+++ b/util/util.go
@@ -11,6 +11,7 @@ import (
"github.com/RasmusLindroth/go-mastodon"
"github.com/adrg/xdg"
"github.com/microcosm-cc/bluemonday"
+ "github.com/rivo/tview"
"golang.org/x/net/html"
)
@@ -53,9 +54,9 @@ type URL struct {
}
func CleanHTML(content string) (string, []URL) {
- stripped := bluemonday.NewPolicy().AllowElements("p", "br", "li", "ul").AllowAttrs("href", "class").OnElements("a").Sanitize(content)
+ stripped := bluemonday.NewPolicy().AllowElements("p", "br", "li", "ul", "ol").AllowAttrs("href", "class").OnElements("a").Sanitize(content)
urls := getURLs(stripped)
- stripped = bluemonday.NewPolicy().AllowElements("p", "br", "li", "ul").Sanitize(content)
+ stripped = bluemonday.NewPolicy().AllowElements("p", "br", "li", "ul", "ol").Sanitize(content)
stripped = strings.ReplaceAll(stripped, "
", "\n")
stripped = strings.ReplaceAll(stripped, "
", "\n")
stripped = strings.ReplaceAll(stripped, "
", "") @@ -64,11 +65,37 @@ func CleanHTML(content string) (string, []URL) { stripped = strings.ReplaceAll(stripped, "", "\n") stripped = strings.ReplaceAll(stripped, "
", "") + stripped = strings.ReplaceAll(stripped, "
", "\n\n") + stripped = strings.ReplaceAll(stripped, "