From 2dc9fc1626507bb54417fc4a1920b847cafb27a2 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Wed, 25 Aug 2021 15:34:33 +0200 Subject: Pg to bun (#148) * start moving to bun * changing more stuff * more * and yet more * tests passing * seems stable now * more big changes * small fix * little fixes --- internal/text/markdown.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'internal/text/markdown.go') diff --git a/internal/text/markdown.go b/internal/text/markdown.go index 5a7603615..eeeae0edf 100644 --- a/internal/text/markdown.go +++ b/internal/text/markdown.go @@ -19,21 +19,23 @@ package text import ( + "context" + "github.com/russross/blackfriday/v2" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" ) -func (f *formatter) FromMarkdown(md string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string { +func (f *formatter) FromMarkdown(ctx context.Context, md string, mentions []*gtsmodel.Mention, tags []*gtsmodel.Tag) string { content := preformat(md) // do the markdown parsing *first* contentBytes := blackfriday.Run([]byte(content)) // format tags nicely - content = f.ReplaceTags(string(contentBytes), tags) + content = f.ReplaceTags(ctx, string(contentBytes), tags) // format mentions nicely - content = f.ReplaceMentions(content, mentions) + content = f.ReplaceMentions(ctx, content, mentions) return postformat(content) } -- cgit v1.2.3