mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 17:52: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
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue