mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 11:42:24 -05:00
Text/status parsing fixes (#141)
* aaaaaa * vendor minify * update + test markdown parsing
This commit is contained in:
parent
ff406be68f
commit
ce190d867c
56 changed files with 7390 additions and 45 deletions
|
|
@ -19,6 +19,7 @@
|
|||
package text
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
|
|
@ -27,6 +28,9 @@ import (
|
|||
func (f *formatter) FromPlain(plain string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string {
|
||||
content := preformat(plain)
|
||||
|
||||
// sanitize any html elements
|
||||
content = RemoveHTML(content)
|
||||
|
||||
// format links nicely
|
||||
content = f.ReplaceLinks(content)
|
||||
|
||||
|
|
@ -39,5 +43,8 @@ func (f *formatter) FromPlain(plain string, mentions []*gtsmodel.Mention, tags [
|
|||
// replace newlines with breaks
|
||||
content = strings.ReplaceAll(content, "\n", "<br />")
|
||||
|
||||
// wrap the whole thing in a pee
|
||||
content = fmt.Sprintf(`<p>%s</p>`, content)
|
||||
|
||||
return postformat(content)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue