From b7ec6b50d82bc9c2e453e389e1fbe22ea68963f8 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 14 May 2020 23:06:23 -0400 Subject: [PATCH] translate chat to html --- activity.go | 2 +- fun.go | 6 +++++- web.go | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/activity.go b/activity.go index 6800910..c1419e7 100644 --- a/activity.go +++ b/activity.go @@ -1287,7 +1287,7 @@ func sendchonk(user *WhatAbout, ch *Chonk) { jo["published"] = dt jo["attributedTo"] = user.URL jo["to"] = aud - jo["content"] = ch.Noise + jo["content"] = ch.HTML j := junk.New() j["@context"] = itiswhatitis diff --git a/fun.go b/fun.go index 0c61493..7b88c18 100644 --- a/fun.go +++ b/fun.go @@ -182,7 +182,11 @@ func filterchonk(ch *Chonk) { var htf htfilter.Filter htf.SpanClasses = allowedclasses htf.BaseURL, _ = url.Parse(ch.XID) - ch.HTML, _ = htf.String(ch.Noise) + noise := ch.Noise + if ch.Format == "markdown" { + noise = markitzero(noise) + } + ch.HTML, _ = htf.String(noise) n := string(ch.HTML) if strings.HasPrefix(n, "

") { ch.HTML = template.HTML(n[3:]) diff --git a/web.go b/web.go index 3109d83..14020f4 100644 --- a/web.go +++ b/web.go @@ -1814,6 +1814,7 @@ func submitchonk(w http.ResponseWriter, r *http.Request) { Noise: noise, Format: format, } + filterchonk(&ch) savechonk(&ch) go sendchonk(user, &ch)