Text/status parsing fixes (#141)

* aaaaaa

* vendor minify

* update + test markdown parsing
This commit is contained in:
Tobi Smethurst
2021-08-16 19:17:56 +02:00
committed by GitHub
parent ff406be68f
commit ce190d867c
56 changed files with 7390 additions and 45 deletions

View File

@@ -23,21 +23,14 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
)
var bfExtensions = blackfriday.NoIntraEmphasis |
blackfriday.FencedCode |
blackfriday.Autolink |
blackfriday.Strikethrough |
blackfriday.SpaceHeadings |
blackfriday.BackslashLineBreak
func (f *formatter) FromMarkdown(md string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string {
content := preformat(md)
// do the markdown parsing *first*
content = string(blackfriday.Run([]byte(content), blackfriday.WithExtensions(bfExtensions)))
contentBytes := blackfriday.Run([]byte(content))
// format tags nicely
content = f.ReplaceTags(content, tags)
content = f.ReplaceTags(string(contentBytes), tags)
// format mentions nicely
content = f.ReplaceMentions(content, mentions)